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

|
网页之跑马灯文字特效
//修改宽度5 f! W6 V z \9 V6 F
var marqueewidth=300
P, D' ?2 i; x3 M" O$ B//高度; [; L4 e1 T: v6 W$ U7 w& G' z
var marqueeheight=25
6 n7 _, V+ t5 y* J9 F1 p9 `//速度(1-10); C2 [6 n8 _$ D; w
var marqueespeed=37 n' T! Z: X3 u2 M, x s
//背景颜色
# y; w7 {) }& U8 Mvar marqueebgcolor="#FFFFFF"
L/ K1 w8 T+ N5 m//是否能暂停 (0=no. 1=yes)?; u5 @# z+ h3 j4 q. s
var pauseit=1
! `- F# V$ p% _- R1 {1 D* j( O& T' C. M/ P0 N* b% X# Y
//修改显示内容$ x3 |) ^, G! T+ `- o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" i$ o* N$ }$ v$ `4 A4 ]6 G5 m7 q
8 y4 h2 i0 C% y' e- d- O: H) f# b3 @2 z. Y# _
////下面不需改变////////////
- q* \% u) M5 ?- G; {( S# O9 W! i. H
var copyspeed=marqueespeed. g0 |9 {' O8 Q! f6 H$ `
var pausespeed=(pauseit==0)? copyspeed: 00 w) Z- a8 z% v7 v3 y( e
var iedom=document.all||document.getElementById
( o: I, ?, g A+ @8 vif (iedom)
4 D& O; R8 `# q( }+ ^+ x$ b. o. kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 Y5 w% f( L7 u- i o# z, u xvar actualwidth=''
5 n4 l5 C" S6 }6 ivar cross_marquee, ns_marquee
1 \3 m0 r C* m2 p" @' Z9 D3 b1 h( y/ r1 Q
function populate(){* Z1 u/ c# \& Q( Z
if (iedom){
4 N0 `- O' ~' ]6 Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' O+ e& F. U+ @+ Q' H0 ocross_marquee.style.left=marqueewidth+87 e, l" H! N+ r8 Y0 q
cross_marquee.innerHTML=marqueecontent
: B+ F1 h7 H, ~* t2 u3 wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( R S0 ^) O& }; z3 d$ U& T9 A
}" p( m. n/ g; E$ }; h* @
else if (document.layers){! d: f3 v& O0 `( `0 y
ns_marquee=document.ns_marquee.document.ns_marquee2
" K/ `9 d6 T$ h5 N' r) O; h- hns_marquee.left=marqueewidth+86 \9 Z* H5 t( g! w7 W% z; ~
ns_marquee.document.write(marqueecontent)# L% P) ?1 e& ^- }7 p
ns_marquee.document.close()
8 {$ o8 t; I1 I0 C7 Gactualwidth=ns_marquee.document.width% s# h/ g2 F8 h8 e8 P( }; f
}
8 w! ^$ Q, ~! R9 S" I% Ylefttime=setInterval("scrollmarquee()",20)
" l3 Q* C# Y( b7 _. v# k8 J}% d0 F! `" X, s/ }. v: Z/ a) g2 H
window.onload=populate" M6 h0 `4 l9 [- Q9 T
1 E+ l. K4 \- ? U2 W( y# \$ i( ofunction scrollmarquee(){
: M3 q) S4 S% g4 n% j) \3 P0 O+ D( lif (iedom){
# o: M- M% m& a( c f1 Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 r1 Y! ]* r/ G. F; X6 r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 c8 v( B% G& G5 N. K4 @- K: u. ?
else
) Q' u2 I; n/ w0 g7 R! @- S1 bcross_marquee.style.left=marqueewidth+81 V; g. h) N/ Z* b' V# p3 Y
+ [. ?! Z0 v" Y H( n
}) e) x( a$ A* F" E9 N3 `/ y
else if (document.layers){& T% i8 A8 Y2 J3 R; v
if (ns_marquee.left>(actualwidth*(-1)+8))- \2 a; }6 U+ w# @% i: I5 ]
ns_marquee.left-=copyspeed
, E1 ?6 M3 m7 [2 C( Celse, r; K/ H. v# `- u& e: Y' s
ns_marquee.left=marqueewidth+81 `* Q' B' `: T2 E
}" l" r. `: h) {3 t9 n/ N, o
} | `! ~% B, `5 T" h$ t3 q% g
5 A& o& U) `# _5 Z4 G, D
if (iedom||document.layers){
& U: d/ p( o2 b4 ^4 P( iwith (document){0 W- g" i8 c- ~2 N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ W: Z$ ~2 a2 u0 v! f
if (iedom){
/ {2 i$ z9 b8 D4 @& T1 [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' \. G+ C% }6 R. ?5 K, o+ n" \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* w$ V4 ^, d* I2 O" m, G/ M/ b* c( l' ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 r4 l& B, z% y( |0 m0 Ywrite('</div>')% t9 L) X3 ~7 P/ a9 d5 h7 y6 D5 H8 N
}
2 g5 T% X8 @7 s0 nelse if (document.layers){ \1 o" F/ E* k$ Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- ^$ s2 Q) J& Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 e' a _3 r/ S Q! e8 U( b; D
write('</ilayer>')8 X. e9 `6 M1 i% ~/ C) u* \
}
- r0 `' D! P! M, {7 h9 A% Q1 {2 [document.write('</td></table>')
2 f3 q. U/ ^& a5 }4 ?$ ~}
6 w. B% U8 y: m! I1 D' w* X}( O* z& n( q- c. t: b. C% S2 N
</script> |
|