|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度/ W1 r7 V8 {9 a5 v
var marqueewidth=300, H) u/ H' Y0 j8 ?* x
//高度
! b+ O/ s* r; D8 wvar marqueeheight=25
8 D# }$ Q8 b* G; ^# z9 V. W2 Z8 V//速度(1-10)
; F+ b1 ]2 Q, z! |9 W) Uvar marqueespeed=3
6 s0 ?3 L- ^* v' y5 p8 O0 @//背景颜色6 U/ z" @8 O, H8 H: o
var marqueebgcolor="#FFFFFF"
: g% ^2 J2 F/ H6 L//是否能暂停 (0=no. 1=yes)?
$ n' b5 e: F) Mvar pauseit=1
) E' [9 e) \" f/ J0 l* C7 X- Q; R1 ^
//修改显示内容
$ a* W" w/ {3 Q: a. jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 H3 s3 C/ b& {% N8 u& f X; u' U% S# K5 \
6 y5 ?5 p$ W+ V- a) J
////下面不需改变////////////5 S) U+ _: o. S3 q. w6 }9 E% S v* j
: y) U; M8 S7 @5 V- x% l" F& M
var copyspeed=marqueespeed
( |3 j: u7 M0 jvar pausespeed=(pauseit==0)? copyspeed: 0; q5 g9 A: s& n7 g3 x) v
var iedom=document.all||document.getElementById, n: ?7 B7 A# S9 d: Y% T
if (iedom), h9 H9 d, S& X/ k+ s# O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), z0 T; Y7 w& S1 B3 M% B% F
var actualwidth=''+ N/ G+ n) V/ C5 A9 V: U' X$ d
var cross_marquee, ns_marquee
- D; i- g$ r3 M- e* C) v0 s
& p4 [: U7 e$ P6 ]( |* qfunction populate(){
5 B2 D# F" I4 {if (iedom){
% p! T) d ?+ l V4 |; gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' e1 K1 O- \( H/ i* Q# Jcross_marquee.style.left=marqueewidth+8
6 f6 ]7 P& x7 y4 J' @cross_marquee.innerHTML=marqueecontent. v: c: U# O- r: \9 K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" p5 _- r* k8 ]5 r t% h% X}
( G0 P: b' [6 C2 V6 p3 i' r& Welse if (document.layers){6 s" V2 y4 k8 _' L/ j2 Q
ns_marquee=document.ns_marquee.document.ns_marquee2* _$ _, j; J' }+ G5 H* H8 Q6 i
ns_marquee.left=marqueewidth+8) R; I7 [& y Z0 `
ns_marquee.document.write(marqueecontent)+ _9 k0 t) A+ a
ns_marquee.document.close()
7 d" g+ ]; z3 P7 B, j2 t# Sactualwidth=ns_marquee.document.width, m# k( ]( | n- a- y: l
}8 y2 h' I( @8 ?! e! ? ?) |# d
lefttime=setInterval("scrollmarquee()",20)+ ^1 z/ a, U2 r/ U. s
}
0 @8 D1 K! i4 E$ c2 }6 {( i# wwindow.onload=populate3 A. \6 N" @( z" u$ J6 _3 J [
; V' Y$ W" q+ e( K$ M4 Wfunction scrollmarquee(){- G8 S( I# F, Z5 d5 s
if (iedom){
& ]/ v# K6 F3 aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 }2 ^: ]3 X. ?' N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 }# Y* J# m, `, _( x; s
else
; p& V' e6 E& g7 Ucross_marquee.style.left=marqueewidth+8
0 G" ]6 @) o T! a. p! T3 R+ W2 g) X" M
}+ \: l& r" |$ U3 _* C. g
else if (document.layers){
+ T* ]$ Q' o- V1 y3 ^+ s$ ?1 {if (ns_marquee.left>(actualwidth*(-1)+8))" ^/ S( Q$ I- U" `% N& U
ns_marquee.left-=copyspeed
7 R$ q8 T$ l, G( melse
6 N8 u/ x. `; S; S/ S& f ~3 hns_marquee.left=marqueewidth+8, a' b0 W6 W g9 W6 w; C: g8 N
}% g' f9 X) B. o; x7 `! @& K/ t! V% j
}
2 [- \! N% h. J, L0 O
4 Z" G! Y$ E5 [* i8 Rif (iedom||document.layers){
: J2 d( ^5 V4 C' ?9 D+ ^" swith (document){* u" [. V B; X. ?+ p9 o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- y) k, |' ~& u3 I+ f
if (iedom){" K2 ^3 w2 d) j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& n9 n) H4 y5 B. zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ u5 m% ^ \+ |% P" y/ v1 G) Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 b4 J6 l0 c! G
write('</div>'). K# b1 Q6 W7 `
}
6 H5 D1 d) z/ ~( ]else if (document.layers){3 V0 q& \% f9 m' N6 j5 G3 G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 ^+ b4 o F6 ?7 W* O" k! m3 K$ |9 f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), z1 m; y5 t! u+ q0 c& B! ?7 C# j
write('</ilayer>')
4 B4 ^: H# L5 l) _}
, C. B" Z3 h3 b+ \& I+ Z' |! Xdocument.write('</td></table>')( b* r! q0 _9 t) J& |: c$ A
}
3 z! [. ]( U+ P2 {* o/ U}
6 P8 J' h. e& N" h' ?5 I</script> |
|