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

|
网页之跑马灯文字特效
//修改宽度4 p8 B" u, l) g$ f$ v: F% t: I
var marqueewidth=300: c( ^3 t3 U% a. W! C
//高度4 b8 | X0 b; s# c( F3 N4 n) H4 }
var marqueeheight=25
4 |/ l L$ Y9 b5 ]//速度(1-10)
) c/ R& m5 n/ W+ V% t: Uvar marqueespeed=3
/ b6 x, X* e. j9 L4 a+ y//背景颜色) A: I+ Y/ |0 T5 Y. F! Y
var marqueebgcolor="#FFFFFF": }+ s+ L' s: c+ I0 d/ x, H9 V
//是否能暂停 (0=no. 1=yes)?
+ \! q1 z2 ?9 B% v* Qvar pauseit=13 M8 z% Q$ ? S9 ?: A* T
& H" q" r2 H# }% e
//修改显示内容
$ u* G% j+ y" x) L* ]* [5 Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# x% f5 T4 v1 X. ]4 i0 n9 ?7 f* p' d' q4 a2 c' H
/ K* u/ Q' o- u5 k
////下面不需改变////////////* D' c, J8 T* j8 c
- z1 x8 Z2 x h" X4 M ~
var copyspeed=marqueespeed
1 q }) y3 o" ]. H. w1 P; Lvar pausespeed=(pauseit==0)? copyspeed: 0
/ O& e4 N4 J# \var iedom=document.all||document.getElementById) X8 ~- A/ R9 x3 I% A$ H5 t# V; L
if (iedom)5 }( V+ @- V% C+ X2 ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% k# P/ P# ^- t" W- d/ N9 d
var actualwidth=''
9 [; ]% h, J! G* ^: `+ yvar cross_marquee, ns_marquee- N. s) ^7 c" i; P) X' x3 L
4 m- G9 T- b: ]2 `( W0 ]4 T% ~+ F" }4 r
function populate(){9 m7 |! w1 J6 D% h. i4 G" q! e
if (iedom){
# ?- x" c1 q$ i/ Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( O( |5 Z" }6 f
cross_marquee.style.left=marqueewidth+86 \$ S4 |" ]; p1 a U
cross_marquee.innerHTML=marqueecontent7 H. K9 t& o. Z9 K9 E# \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& X6 I" X7 Y/ g, h5 a5 M}! H+ p8 s2 Y, Q; ]
else if (document.layers){) S# Z" ^/ F9 | ^
ns_marquee=document.ns_marquee.document.ns_marquee2# `" K4 K, _( H
ns_marquee.left=marqueewidth+8
* u% B4 P7 I, \4 A" cns_marquee.document.write(marqueecontent)
7 ~0 e( H0 H: l# |- k+ z; ?ns_marquee.document.close()
! f# q6 a9 M8 J/ factualwidth=ns_marquee.document.width, u0 n9 b1 |( x1 m! L+ w
}
5 _5 ? v6 }7 j+ h! tlefttime=setInterval("scrollmarquee()",20)+ Z/ O8 k+ K& ~9 F+ o0 J
}9 P+ |. Q9 U4 A: O: R- U
window.onload=populate
2 ^8 X/ \' }6 ^0 O" ?; f/ C0 @9 m" O. T2 j1 D. V" x: _
function scrollmarquee(){
7 U L }5 o e3 w4 `# M y9 K- ~if (iedom){
1 z8 U+ K m, Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! X. h, |% a) O, t2 l; z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' y9 a- F9 I* o
else/ d9 c% ^; K1 I C; s
cross_marquee.style.left=marqueewidth+8
. s( K/ [9 q2 G- a) {* R1 T' o
3 y% w+ r6 x6 @, Y* x6 Q}
5 u8 _0 R, R5 E$ j, D7 Helse if (document.layers){
5 t/ J5 [7 z0 iif (ns_marquee.left>(actualwidth*(-1)+8))
" ~/ D( U4 y$ f: V( ^, ans_marquee.left-=copyspeed/ B. M i# T& ]- T: P; O
else j$ i, r$ Q! p5 R0 f1 G
ns_marquee.left=marqueewidth+8
4 T5 e; L% J3 c( Y0 I# U}9 |9 r/ A; c( @# m3 P$ h) W4 H
}
4 ], }0 i4 u4 t: l, {* b1 {9 r# f5 }5 b2 G1 Q1 b2 G
if (iedom||document.layers){6 o, a* ~( Q2 m1 S: r# m1 F n
with (document){$ }) k* L! H' C5 L) v! B) m: @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" h& u9 d. G: s' r( v* }5 F: }
if (iedom){* ]) A- A3 r2 T1 X: R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 \0 `8 w4 z* q' ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" H6 w& |4 _4 }0 L: \( ~8 Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- s8 ^& u- Y9 c+ O3 k* V5 ?
write('</div>')
! ~: h6 Q1 }7 Y9 F1 I4 r, |}- w* t) r0 @" X$ o: I; V- N/ z v
else if (document.layers){
9 U6 v& c, f% k; V: d+ ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ I) W; ]& V; ?# F0 d# rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% S- V9 R1 j! z! _" k- P4 s, W! h& Dwrite('</ilayer>')! x, L% V( j" I: M \8 }
}6 T1 V- h% G& }
document.write('</td></table>')
; R0 G p3 F9 a9 u4 A4 a$ \! L}% S% y" \! c5 Z' M- P7 J9 g
}
7 p' K9 F8 a0 @% n</script> |
|