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

|
网页之跑马灯文字特效
//修改宽度
6 d4 g7 N- V$ Gvar marqueewidth=300, K' L" @6 D6 Q8 g2 _7 J. t
//高度& G/ O- Q5 v1 a: x6 {
var marqueeheight=25
: t3 h9 {- L' l. U//速度(1-10)
! D& r8 l; p+ | b! M% Jvar marqueespeed=3+ q: K0 v: q t# t* A$ |
//背景颜色
: a. i7 ~* [ s( K' u1 Gvar marqueebgcolor="#FFFFFF"
" Y) n+ D* f. _ C//是否能暂停 (0=no. 1=yes)?- x ^5 ]% v; l- T4 D1 J l
var pauseit=1$ {6 z+ R, ]2 U1 i6 m3 N7 N
' w4 |: O/ P# l7 B( r- O# j
//修改显示内容
% g% y% r# x% r+ f! Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' P5 w: X! F, y! Y, M) p
" Q. v$ A7 o0 @$ z: q
. F% \7 h6 }, S" ?" n- b9 D2 \////下面不需改变////////////
& y3 T, x9 F7 v: T
5 ^6 s1 E$ o6 F4 V7 P! Xvar copyspeed=marqueespeed7 b2 W0 p' `9 p
var pausespeed=(pauseit==0)? copyspeed: 00 E& O3 c- M# _" e' v- ?
var iedom=document.all||document.getElementById
, q8 s0 a1 q7 N fif (iedom)
* B) v" F7 p+ y3 }6 Z9 ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 N& k9 c5 a" R) r+ |var actualwidth=''" v6 s4 [ j; P w- E1 \2 D' Q% H: ?
var cross_marquee, ns_marquee4 n3 }3 m* y6 P9 y
6 `' f F( ^. W/ C0 ]
function populate(){. M/ p6 N) G o7 E6 p, c
if (iedom){
* P7 ?3 W4 i, g) N& o! P0 K4 Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- _+ D4 s6 a6 I- i
cross_marquee.style.left=marqueewidth+8$ s# T$ q; u2 x3 D2 @" j
cross_marquee.innerHTML=marqueecontent5 s8 z/ V; s- v3 D3 n/ a& l- H9 M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, r% h' g/ y; P9 w}
) Y8 F" ^! w" q8 a( M1 K! z- Nelse if (document.layers){
& T& m d0 m9 L" ^4 v8 ^. W" e2 Lns_marquee=document.ns_marquee.document.ns_marquee21 F% Z( i' ~$ {8 m
ns_marquee.left=marqueewidth+8
$ [' S% i+ m8 O' Mns_marquee.document.write(marqueecontent)# W9 n- Z H' P X3 ^& P9 P
ns_marquee.document.close()
" O) N" z9 W3 p7 H/ }( a& y4 eactualwidth=ns_marquee.document.width$ C4 Q, B- @0 x: R8 L
}3 W U& c0 l' _
lefttime=setInterval("scrollmarquee()",20)( e- X# ?0 O, w7 [( p1 j9 D! D# F2 n
}# T9 G4 s4 z3 }% l2 w
window.onload=populate
- j6 X$ q% _& v; @2 n2 Q( Z% u" j$ R! X
function scrollmarquee(){& I% N+ N' |! t% U" ~7 }. |
if (iedom){* R& M5 v6 ]" C- w$ |2 `! ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* J. } I: w2 U8 r, X7 ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed P# f9 F, D& y8 `
else0 ] r8 e; `5 i- [) f
cross_marquee.style.left=marqueewidth+8
. `9 c' O% a( T
4 T& p2 `4 C3 i, r}6 ~* s" ]+ S( X
else if (document.layers){* K% Y- `* d* s( f3 t
if (ns_marquee.left>(actualwidth*(-1)+8)); }- _& ]0 X0 S: J+ k1 t
ns_marquee.left-=copyspeed
0 c# f9 Z/ i7 melse
. Z# C7 p# c. o: mns_marquee.left=marqueewidth+8
, d( d }. ?1 \6 z; c}, U6 v, P- ?/ V
} e0 b" O6 o' S: V& e
6 K2 H: L) |1 G o+ r
if (iedom||document.layers){8 \7 E5 ^) q) C
with (document){
# u! @9 R% i$ _7 jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 }8 E7 u% `! n! j A- eif (iedom){9 R _6 u, i5 g( B7 u0 R9 p+ i1 F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 [& d; ^* _. r. N( `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; e+ j& ~8 X' k) E0 Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, }$ T+ A3 f0 c2 d& E, @3 J6 r) ywrite('</div>')
7 a; B m6 E @, g5 T2 j) _5 i) k}7 @2 z" h: _* ~6 h5 q2 m k
else if (document.layers){) h; i4 j) t& w5 Y, K% n/ E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ q D9 ^' w0 c- _% i4 @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) d7 ?5 K7 K1 Q6 b, j0 hwrite('</ilayer>')
/ E% Z5 s, ?* B}: N4 [# F- C: _ f$ o S3 m
document.write('</td></table>')
9 ?' _( x4 L% x! S! E}
: U4 m9 g+ f4 u( v6 M' A5 A8 ~}
5 e3 D6 V9 k. k- g4 \. P* a5 D</script> |
|