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

|
网页之跑马灯文字特效
//修改宽度; h* G9 t" ?6 \& _7 s
var marqueewidth=3004 G2 R/ ]' R5 g. _, L
//高度
, K1 N! K2 Z* V. U/ Mvar marqueeheight=25- ], N6 ?! Q, U1 J$ P& `
//速度(1-10)
8 b; {/ ~9 f& U( I( Zvar marqueespeed=3
' W! g7 y, N3 e8 [( h//背景颜色0 n" ]5 e, T$ Z! X; t4 F- c
var marqueebgcolor="#FFFFFF"
% O8 [$ F* ?/ N. s1 i* O+ Y//是否能暂停 (0=no. 1=yes)?
% O8 w7 m% n% o. a1 r' S G: `var pauseit=1* e& p! Y h; T+ e+ d
! s6 y5 o( `/ W+ t
//修改显示内容
^6 _" I; R! t4 zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 H8 I, }, h I. K; L' u; U' L' Y
Z( l* I: s, Q+ S( h! R
, S3 C6 d! s+ U2 U
////下面不需改变////////////
, ^( B0 w' ^/ ~4 M4 @2 g
3 t9 z8 ], [" Y0 ^) k$ bvar copyspeed=marqueespeed$ ]4 C0 S1 x6 e# o3 e
var pausespeed=(pauseit==0)? copyspeed: 0
5 O$ |7 y! @& @% r2 ~var iedom=document.all||document.getElementById9 k/ H$ k. N" C% l4 [& Y0 @
if (iedom)+ I! f# L8 S5 J; ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') n) ~! t, O, ^+ _& c- {) k
var actualwidth=''0 w x: v6 m) k
var cross_marquee, ns_marquee
3 n0 g5 w9 T+ c8 W. Q, Q- p. ^+ L) B% w* e" v
function populate(){
: O* U7 M4 Z1 f" _if (iedom){* T9 W8 H' q1 _4 U; W. s2 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee d; G) }( k9 M8 t; w
cross_marquee.style.left=marqueewidth+8: i( G5 O1 j0 J* W8 Z- Q" V
cross_marquee.innerHTML=marqueecontent: \; r. }* l7 q3 V6 [; g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 n- U( ^# s, a( G2 T7 t}0 _/ s# g$ T3 r% b+ r
else if (document.layers){$ I" Z" W8 A0 M6 p/ m
ns_marquee=document.ns_marquee.document.ns_marquee2% ?+ p& g* i( z- M/ q
ns_marquee.left=marqueewidth+88 e4 N( a# Y9 {0 g5 W3 x
ns_marquee.document.write(marqueecontent)
2 v7 p* x3 X6 U: ?ns_marquee.document.close()4 g8 _" u1 ~, l' W" q+ H8 ]2 K% N
actualwidth=ns_marquee.document.width4 ], q$ s( _; S0 \- k2 P
}
+ T+ p" r) B3 j7 w/ _5 `2 Clefttime=setInterval("scrollmarquee()",20)
- m" V+ L, k4 B+ c; K% n}* I4 a1 s/ q6 V Q3 y X! a1 P* m \+ H
window.onload=populate
& h4 e' i' a4 E9 j" Q
% l% R- Q* k: G3 i6 D8 ^& _% rfunction scrollmarquee(){
0 B! {" i6 l7 e6 Q' `if (iedom){
% X; b, m2 x: L0 oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): N+ I7 m% R/ }. m3 Z$ x+ M! D$ g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, e, O _7 N- i. S
else4 m$ ~* j* |8 a7 i# p7 @; u/ L
cross_marquee.style.left=marqueewidth+8
5 s* E7 Y3 Z. u; F
/ p- }( \$ Q! P# [0 c$ G}* K; ^* `' n6 j. f# s+ y J
else if (document.layers){, X2 I% `5 c5 p
if (ns_marquee.left>(actualwidth*(-1)+8)): N( _& B3 c1 M: F0 V- @, }- A
ns_marquee.left-=copyspeed" {! P6 D- d8 q) `
else
; y) n, Y5 G+ i% k+ ^; t1 Sns_marquee.left=marqueewidth+8
, c5 _6 h, K4 Y% M}( I9 f: E9 Z0 ^ b! g4 j
}2 b7 H4 X3 D4 d$ I
- @) O4 A7 s R! q! u3 j# r. E" \- b% I
if (iedom||document.layers){
+ q4 O4 z: x: u' jwith (document){
+ I3 G/ \9 W: s3 P/ M' o; \( fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) r1 U. _3 v# ?% ]( d2 A$ m
if (iedom){3 p% _4 Q, `9 {# m( Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). L. K' S( ^$ O- J" E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 b6 }, H# P" N9 b! r- _/ E( ?9 d! \! n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' j' Z/ E5 V9 ~1 \) s* T! q9 O0 D6 [" ~
write('</div>')0 f! `0 v/ g: d' O+ K2 @$ v+ P
}
' G5 H2 s9 \" delse if (document.layers){5 ]) n Z8 k$ Z9 H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' i# q8 ?4 ?0 g8 Z+ ]- Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 ?4 ^; ?: \8 l3 u' F8 R8 N
write('</ilayer>')
' j% U! h) P) J* h, E}
7 L5 H) i. c% a2 J9 qdocument.write('</td></table>')0 C! h. w7 n* x% E
}% `# Q- z2 R- _" I3 T
}& j, m$ g4 R% W, z( e& f
</script> |
|