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

|
网页之跑马灯文字特效
//修改宽度4 _- _1 R9 V+ J+ x2 Y$ M% P3 `
var marqueewidth=300- G% G4 H- D8 ~
//高度- o- l% x$ A ~; H$ R3 ~1 s, o
var marqueeheight=257 V; @5 V, K3 E, ], N8 q# X, q3 s
//速度(1-10)' I7 ]/ E- C( P
var marqueespeed=3
" b! O+ E. v5 P4 l0 W* J//背景颜色
) ]. } `; y+ S% O0 j' D' M8 k& `var marqueebgcolor="#FFFFFF"" O* N( l) \$ S5 z0 y2 z) \
//是否能暂停 (0=no. 1=yes)?
1 A6 {6 _" q; }# ~6 J: \var pauseit=1 s' u% S/ j) |1 E C* i; X8 H
, C. y- f% S( Z# |; X
//修改显示内容
h- X7 a* z( @' lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' q# g# K+ N* K3 n- U' G+ e4 R
; ?2 I2 d! L% }
0 |5 b* d0 V6 f+ U4 R" ?' E9 {, B////下面不需改变//////////// ^" Z" f7 `8 S. D: E. ^3 z8 y
+ K# y$ A t# |* Z- ` i
var copyspeed=marqueespeed0 n8 G: o: g! o- p
var pausespeed=(pauseit==0)? copyspeed: 0
6 q$ a5 ]' [" B' \* xvar iedom=document.all||document.getElementById
2 ^: g2 X* [4 Y8 Q4 _if (iedom)
% r3 F' C( s' vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% z, X% k& b2 L( c
var actualwidth=''
' \& z0 a+ O( c& }- Ovar cross_marquee, ns_marquee# B! }% R" N/ {9 g) C2 P
5 V$ ]+ N6 T w1 o( z" y! [+ j; H
function populate(){7 ~- L: b: b3 R' L, O$ L7 N
if (iedom){% E% g- q6 F4 t, D$ ^8 j# @+ |3 \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& }+ W3 d# X) x- P' q) H+ g
cross_marquee.style.left=marqueewidth+8
: M* s' T" q7 Y+ l: y, z, F; vcross_marquee.innerHTML=marqueecontent
1 D% t% ^, c1 ~7 q" Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 s9 f! j6 l9 ^$ b n1 @" P
}4 e H, Q8 O; a& ]2 c) p; n
else if (document.layers){+ h4 i- ?" E ]+ U$ H0 x" M) q" `. W
ns_marquee=document.ns_marquee.document.ns_marquee2
, y5 n0 J4 n7 V+ Lns_marquee.left=marqueewidth+8- b0 p+ B6 o6 u
ns_marquee.document.write(marqueecontent)
5 Z/ P4 y" m4 vns_marquee.document.close()
6 i: d: r; y% ~) ~: sactualwidth=ns_marquee.document.width
( P- I5 A4 [& O H) P0 f6 t$ P}1 m Y9 l& Q1 v- g
lefttime=setInterval("scrollmarquee()",20)& N) D1 q% t- @1 T
}
9 f# C+ }1 w2 S0 \window.onload=populate' ]( }4 s! ^1 e: ~( b7 `
, y, C3 z1 w2 A1 D& ^, Gfunction scrollmarquee(){0 z! ?4 ^# ~( F. F+ a
if (iedom){( z& u5 C2 S9 o; w; j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: D5 @$ E/ B7 n8 k( D$ h. z1 vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
w: I1 u) ~ s& o* v6 j" delse: I8 M: Z0 B% h7 ?) X
cross_marquee.style.left=marqueewidth+8( A% |/ l& d. v
; w7 ?! s0 f: w2 ]4 d: e+ {/ S) {1 S- Y}# b0 e9 z9 ?/ R% [2 C# Z$ C" a8 o
else if (document.layers){
, \: R2 P) f" z- O9 J3 yif (ns_marquee.left>(actualwidth*(-1)+8))0 Z' C) {% X9 I# J- J
ns_marquee.left-=copyspeed3 s6 `9 _; c0 R/ r x6 ~, }- M
else
4 W) b+ n4 K* H: S7 Z% rns_marquee.left=marqueewidth+8
6 q k t' x( R. |6 s1 S}+ f; v, n8 i" A
}2 j% q# f' ~9 o _, h
U- V: @( s- G8 t3 W; d; L2 a) V, l7 [if (iedom||document.layers){. e" E/ y% y- g" v7 M/ s
with (document){2 j4 N; T8 _8 s! U3 H! e5 w1 Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; z" s/ U4 e4 G% Aif (iedom){
6 ]# P$ B0 W" n9 J' B) A8 h( twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ s# h0 |+ O: ]) q/ y0 Z) h7 U* rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ b0 U: ]7 W' \' O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
y1 m% U8 q7 x4 j6 I/ ^8 Hwrite('</div>')8 _7 T3 w; X! P6 C1 \
}4 N+ @' G5 P$ _7 p9 K
else if (document.layers){
# Z* S* I8 c# l& H6 g* }2 twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% v- n' Q9 m( jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 c1 Y b$ l# P5 u* O+ E' uwrite('</ilayer>')) k3 y! s; n! n- { x1 i
}
* y e% g" Y; o: b! Z& e2 M+ g& ]1 \document.write('</td></table>')9 K* L, A9 S1 J: @; R
}
1 O) I" h" T5 {# K6 o}7 `0 @0 i0 T' p# W
</script> |
|