返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; s0 ]. Q  C/ a& hvar marqueewidth=300
1 M8 a/ K+ T' e. Q- Q7 I* ^//高度* A, F0 `1 t3 j8 ^* D/ O/ h
var marqueeheight=25
& d9 I; S$ B3 @7 n6 }( g9 a//速度(1-10): m  e" |6 Q" B. e2 E# W( N  U
var marqueespeed=3) ]+ Z  H+ S% S/ h
//背景颜色
1 m7 W# P/ T2 A0 G% ivar marqueebgcolor="#FFFFFF". O) ?/ H5 {& B6 P2 e
//是否能暂停 (0=no. 1=yes)?
! ]4 t( L& O4 o! F% }& f  }$ Hvar pauseit=1
# H- i# _; ?# _$ C" o) R% O. g- Q, `  C; v6 H. g9 C) E. U
//修改显示内容
4 b! j/ Y3 q) U1 Z' I  y3 V8 Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& z" ~. C  x; B3 a5 W

* W  \2 }0 C# ]- `3 n- O1 q6 f* U1 h) o
////下面不需改变////////////4 h: \3 R# _. @5 b# h  O$ ?
2 L) {' |% o- b. q
var copyspeed=marqueespeed
( Z2 \( R1 y% _9 [  |% D" {- ?var pausespeed=(pauseit==0)? copyspeed: 08 u, T3 c1 j. x4 n
var iedom=document.all||document.getElementById
) [  j+ [* d% g: X- ~9 aif (iedom)1 L4 x# W' F. a( {* n; G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, q2 f. O2 O, ^, }1 o6 M* A; Y+ u# Qvar actualwidth=''
* u. ?7 G) T: [* N4 svar cross_marquee, ns_marquee. ?/ o9 S8 S' m+ E% ]

; Y( u* r7 P+ `+ O. ?$ u3 |  ofunction populate(){9 d. |4 }, }7 q, y
if (iedom){- S& w* `( @' _  W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ U1 S0 y5 N$ @, N" A0 a) `
cross_marquee.style.left=marqueewidth+8$ O% j: a% ?" W! J/ P1 Y
cross_marquee.innerHTML=marqueecontent$ V- o, w& a9 O( d( J0 ^* j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# J! \* d0 k& N8 J+ h% C- o
}
- _6 I3 u2 R% J6 }# Y" y0 Zelse if (document.layers){
: E. b# u( D. E5 l% xns_marquee=document.ns_marquee.document.ns_marquee2( ^5 s& i5 V( ^- b# {2 w+ \
ns_marquee.left=marqueewidth+8$ D, B1 ~% H1 n
ns_marquee.document.write(marqueecontent)% ]# s1 O8 T$ e- I
ns_marquee.document.close()
0 a8 m& q- F/ aactualwidth=ns_marquee.document.width/ o5 D; L7 m+ \# o3 a
}
6 z4 U0 U" y1 b7 F+ Ylefttime=setInterval("scrollmarquee()",20)
2 Y: r& K  a& y6 k}
( t+ {3 r5 c2 [! x# J  rwindow.onload=populate
* d1 c* {( |5 h5 R1 y' E* n5 M3 c5 y; c5 u. K6 t+ C* H+ _  G$ N+ ~
function scrollmarquee(){% L: d- R( a  d+ O7 }3 W
if (iedom){
( ^, k8 w8 X4 C% {6 ~/ Z1 cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 \1 T& Q; O& R* d$ `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 b' j9 S% s$ x$ a5 g- }" o& Kelse
$ [" F$ {) K1 u* D* z8 Ucross_marquee.style.left=marqueewidth+8
) ^# m% l9 d) [6 u/ c- |* M% x* y, d% M6 o8 i: Z3 X2 T7 f
}
9 B# Z: r- C6 selse if (document.layers){" @' }5 D  z: u% U
if (ns_marquee.left>(actualwidth*(-1)+8))! C) A- [7 F6 V  E
ns_marquee.left-=copyspeed0 V# ~( _% g0 i) b; {7 g
else, I5 m' C6 T4 Y# g
ns_marquee.left=marqueewidth+8
6 W3 X" p9 f7 L1 b% N! R}& t) m2 H/ R/ R: l- D' h# L
}
' k' |+ R; I* r1 k
. e3 Y  j: g+ `* h1 Gif (iedom||document.layers){2 D/ |0 @* G1 O* I) W) D5 k! `; f7 _6 \
with (document){5 q5 U! ?- g! U* Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 M7 U, G7 f$ j/ E1 j( Eif (iedom){
# e* A+ ~* l' G+ B1 wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 k) |2 y% u1 g$ R; R* o+ Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ p) C. \/ X7 ^2 \6 F: Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- |- H: {( A$ f/ m3 }
write('</div>')
. f& p# }: z; a9 }}2 X; C. u+ _4 t
else if (document.layers){
3 A/ F8 g9 P/ Y( kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 K1 ~/ ], {6 h5 X. F, \( cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: {# M! Z, C8 h7 fwrite('</ilayer>')0 S/ a/ s) v* O" w- o0 A3 k* E7 p
}; z4 w" s' B/ y: R+ T. a. ^
document.write('</td></table>'); ^, k* {" Y, {$ H
}
/ ~! A8 z: d9 j3 b& d  u}8 m% _) Q% Z7 F4 k) t. b8 k
</script>

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