返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; N( [5 q. f0 {& [+ {2 Avar marqueewidth=300
/ I1 o$ k& A2 ^$ z0 X4 }4 v1 g$ N//高度0 W; p( l- _- Y! E, o% C
var marqueeheight=25
# K& y/ Q% X9 s% l) T9 B+ S//速度(1-10)
8 f2 z2 I1 U7 b( b8 Nvar marqueespeed=3
( f. T( l! F$ \$ H/ G//背景颜色
/ ~0 |6 ?+ P, D# s% k3 t% r5 tvar marqueebgcolor="#FFFFFF"
& |5 `! o! x' I9 I, c& D8 @  Q9 N//是否能暂停 (0=no. 1=yes)?& r! X9 |3 n9 R3 N
var pauseit=1# P0 d8 M0 Y7 [' f/ z: g% W

" Q) V3 Z% K0 ^' {' J% l//修改显示内容# M$ g* Z0 n+ K+ K0 c! z* H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 e7 q/ h" [& D* l$ Z  ?
- }5 Q- Z, K* @" ]6 P7 g0 r6 R& G# l8 @! C) O2 v
////下面不需改变////////////
0 c" p  I( z+ m+ ]2 @8 r
- W/ _/ p+ E+ b9 b9 M# c4 Rvar copyspeed=marqueespeed( @) ?# A+ {6 [
var pausespeed=(pauseit==0)? copyspeed: 09 L3 x+ M; D  K! o+ X. y
var iedom=document.all||document.getElementById. r& U1 I2 Q0 v0 F+ f/ h) R
if (iedom)
" \" {( q$ b; X$ Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* Q+ G- n' q' n! w# f) ~$ P
var actualwidth='': z: j& g% |$ Q2 V, {5 t$ k& g
var cross_marquee, ns_marquee' L, |2 C7 I% R: _" p

! w* G9 B! Z9 C  n# W, D3 N- {. hfunction populate(){
& y9 `) \0 N: s  I- \if (iedom){
( e) i, M! _7 v6 k# ~5 k1 P/ f: ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 @/ e: ?. t( k" U# w2 U
cross_marquee.style.left=marqueewidth+8
/ ^- O0 Q9 A: p' ?4 ycross_marquee.innerHTML=marqueecontent  @6 l' H- G* e& q  t8 d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 e7 ?/ s( \9 P; b$ m+ C7 T}) s. K2 u) f( G& U. I( K2 @
else if (document.layers){$ A& L3 ^; A" H  |/ x. I; }) [
ns_marquee=document.ns_marquee.document.ns_marquee2
2 y7 A% V: L# V* _* r  N; ^3 Uns_marquee.left=marqueewidth+8* }) ^8 |( i. G
ns_marquee.document.write(marqueecontent)
4 _  i* y4 E0 P/ |/ Hns_marquee.document.close()
1 O. ]9 ^* E/ T+ m0 Tactualwidth=ns_marquee.document.width9 q0 |- t5 c' q3 y3 p
}
" ~9 t' z/ k/ t+ f# T, r- M0 b+ klefttime=setInterval("scrollmarquee()",20)
" |5 P2 y$ D0 D4 }  T# S}" ]# a; ]( S$ e
window.onload=populate2 e# i# q7 M, H1 x# z: @/ [% r

3 X3 i+ b' g7 C2 ~, {function scrollmarquee(){2 ]+ G: J4 v# c
if (iedom){
3 A2 z* b& x, N# s2 ^6 `! z( f' Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. g+ l. g$ u# e% ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 ?! v- Z, z2 ]0 x- Relse) q/ _( x4 R, g" T9 t$ l
cross_marquee.style.left=marqueewidth+8
6 R( R! t: e" G4 n1 }' }% T+ ^. N- f' f8 P) x# z3 y- f" I+ {7 L- R% d
}
" v1 @( y) @/ s3 [else if (document.layers){- q5 e; [, ^$ K9 x: d
if (ns_marquee.left>(actualwidth*(-1)+8))
( C! u3 F% i4 R+ rns_marquee.left-=copyspeed  ~; V: W4 G$ o$ x3 r! r
else$ P. W( Q+ m6 q
ns_marquee.left=marqueewidth+8
1 W" |3 D7 b- [. t: B2 f- h}( r7 ~, {" E0 j3 a  Q
}
, [8 [8 r$ w* ]% N  n& H/ [& X1 v+ H, z( n
if (iedom||document.layers){
. I4 P. }- _9 v- A- w& @with (document){
, L6 w0 {3 O! w$ qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: l& z6 G2 y7 Y+ Yif (iedom){. w8 A' U$ X6 s/ m0 }- f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 _; I0 ?& ^( W5 k4 D" f1 uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ Z; i0 ]6 l( n! V) S8 q, k5 e! s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 Q7 }' o: c. |1 jwrite('</div>')2 Z% v- s  l* g2 v* c8 v
}
, l, x! o# D6 K, o, ~2 A( O  _else if (document.layers){& D6 F' \3 ~( D2 G3 u. D4 l1 ^$ c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 o! |6 \7 }, k9 V9 [0 w6 p- ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 \) a+ }; C4 p/ M
write('</ilayer>')$ e! f0 W; ^2 [3 {
}% K$ _' z# ~! l; d) }  I2 j) e: L+ g
document.write('</td></table>')+ T" a* ], G4 D9 v
}
& F5 z% b! R7 a# [( L5 t; ~}( j( w: N8 ]$ `) x$ L
</script>

返回列表
【捌玖网络】已经运行: