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

|
网页之跑马灯文字特效
//修改宽度( K3 P* c; Y6 T% R Q) e- Z
var marqueewidth=3009 R7 F) p" u3 D3 E# j3 F- i+ e
//高度7 l. t( h. B/ g* G
var marqueeheight=25
2 x0 W, B6 Q& I3 T7 ?* ~; x//速度(1-10)
4 A5 G/ a/ u* Z1 j' ^9 d, l) Xvar marqueespeed=3
( L+ D# e9 B! N. {' ?//背景颜色
3 Z6 \1 Y) y/ _var marqueebgcolor="#FFFFFF"
/ L( r3 J' T' z$ w//是否能暂停 (0=no. 1=yes)?
( U" @5 D# j Q# Q5 x6 c9 lvar pauseit=18 p. S5 I0 \7 v% E% O+ x
! u# U. z3 C' L3 {8 a//修改显示内容* b- E8 Q6 x" _6 z; X5 p2 a. W2 w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ O) L7 `. G T9 u- E/ r% c: U U+ a' l! h8 r) @& c
. L1 m8 G k; I# [////下面不需改变////////////9 Q) o' m/ u" d( ]. T. ]
! f- i+ u, a, y# W, mvar copyspeed=marqueespeed" C6 n: P) K7 c, w4 N# u) P2 l8 U
var pausespeed=(pauseit==0)? copyspeed: 0
; D; m7 e$ D! Yvar iedom=document.all||document.getElementById
% K4 d, O& J+ u# ]1 ]8 K9 B" Rif (iedom)' w2 S1 V3 a* ?2 m, ]6 B) M3 L$ G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* j \9 P9 i% c# x( gvar actualwidth=''
( Z' s V' {" T: X8 j( P1 bvar cross_marquee, ns_marquee5 f; V5 Q/ z( F7 m0 Y( s7 J
: a3 G1 i, p9 R4 k$ yfunction populate(){
' H# W% n, a+ y; X! q) l& B- Lif (iedom){
! L& K2 {; a$ m4 g4 g( [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 M o* d& h/ {
cross_marquee.style.left=marqueewidth+8
9 ]5 M/ }) m) T* V( d- ocross_marquee.innerHTML=marqueecontent
3 e$ _3 K) N: ?) |& j( t: mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! {, n9 I; p: y7 G5 I
}
p7 \8 {5 K; U# V2 A4 C! _0 qelse if (document.layers){
1 c6 ^% ~9 s: V- E0 f+ d' t) \ns_marquee=document.ns_marquee.document.ns_marquee2
2 E0 }! v+ |1 U) i, Y5 b3 W+ Fns_marquee.left=marqueewidth+83 S2 q. A; P1 l
ns_marquee.document.write(marqueecontent)
: }2 i D6 B4 q8 p) U* E# Q6 h, Bns_marquee.document.close(): a1 b1 u1 Y$ D+ G, y* }, G
actualwidth=ns_marquee.document.width% j' b, v+ e+ R x7 m6 e
}
& E$ E8 r$ y! S( X# I4 J2 j' Olefttime=setInterval("scrollmarquee()",20)
! v" S2 R% A. N; L}9 j" r- K' W7 k5 R) R7 z+ V
window.onload=populate& Y/ [* D K& ] ]5 m4 ^4 ^
8 F: K$ A! w" {' Mfunction scrollmarquee(){
2 B- L! |, z3 U* a3 Jif (iedom){% _1 r; \, ]- t1 _7 N# H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 F- l1 M# ~2 [* z! `5 b- [( o5 Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 u3 j2 o1 J& F8 A+ M1 helse
2 d2 v9 q# [0 }( q, d% w! Jcross_marquee.style.left=marqueewidth+8
9 L I3 x, M7 g1 I, u/ \1 \ M- e( m) r- ~7 k. ~
}
/ O' q% r' H4 A5 ?9 Telse if (document.layers){% {0 w; I% c- w7 G$ M
if (ns_marquee.left>(actualwidth*(-1)+8))
6 f4 k7 ^7 ?* q3 i: l* k7 s) Ens_marquee.left-=copyspeed
/ y! @+ a# l9 X! Melse
" d, e7 u) Q+ i- t- T2 y; ^2 Z, bns_marquee.left=marqueewidth+81 w5 x6 Y8 s: M4 o+ k: O
}
' {$ k7 v- |0 y- C8 G/ J# \: l}
0 I, q# ]) t2 A. V+ Y- o
6 m8 F$ S X. gif (iedom||document.layers){; [$ Y( ^2 G( {4 u6 Z
with (document){- _" `( N! ]2 C. p3 h+ @, z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* ?9 b% X) [ h! C% Kif (iedom){
4 j" Y \$ f& _* T) r" Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& a* U/ m* h1 N4 @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ L4 t: d! d* _, ?% N2 \) P+ z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& s# j) {% [- B4 ?; Z* E& G
write('</div>')
( n1 b7 I {* P* U( \8 p}
/ K6 X+ J2 L8 }, y/ k$ Lelse if (document.layers){! [; }" L$ i8 E5 }: B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), P4 }, D S2 ]# U, k1 {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), x |9 S7 X' [, w( _
write('</ilayer>')7 F/ o" U/ Z( ~: n5 F6 q3 g& B
}) g* Q& Y4 r: B" |( r3 F' E
document.write('</td></table>')7 ?/ P- g$ |8 r* W% z
}- }7 s. ^7 t3 k4 J2 x7 Q, {
}
, u9 B1 g2 x9 x3 P6 s2 R' A$ H</script> |
|