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

|
网页之跑马灯文字特效
//修改宽度
& B8 n% C# a. P' X& ivar marqueewidth=300 f: ~8 X" |7 j6 m( z) \
//高度
- G8 E. O: N7 k; _1 F* r/ \/ [' `var marqueeheight=25
2 `1 _. R7 B$ j+ N ^3 D//速度(1-10)
2 X! z3 n, ]( N g# k1 kvar marqueespeed=3
7 e! M+ }8 b( y1 _# m//背景颜色5 C L, f2 O$ s& h0 \0 @* E0 m
var marqueebgcolor="#FFFFFF"6 z5 F4 i1 T2 ?$ O
//是否能暂停 (0=no. 1=yes)?
4 I p( x" r/ a5 fvar pauseit=1/ {' w! j. L2 e8 K
2 ?) X R1 m" j m
//修改显示内容
" V# ?, L7 }) i$ C' o% nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' d0 a# o) Z4 j% R7 w
?2 b: r' e3 q2 A, a# _% \( d. O
////下面不需改变////////////
* F+ ?7 i0 {7 X& C
; h* l2 n9 R" h3 V; j" ^% yvar copyspeed=marqueespeed) S2 r8 B5 v, R$ f; b# }
var pausespeed=(pauseit==0)? copyspeed: 0 g# @( c. R& H1 b1 R' `
var iedom=document.all||document.getElementById! @* i. Z2 ^3 Q7 O
if (iedom)5 B) e: T9 d, I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% ?( v P% d% Z/ ]1 Evar actualwidth=''2 j3 X: Q) T# c3 X; v9 Q, V
var cross_marquee, ns_marquee
( `- g4 G) p! x9 s5 `' x- I7 C0 K1 o* N5 f2 W
function populate(){% R' W3 G% b; I$ _ s; }
if (iedom){+ p5 j( Y2 `/ {& }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 f0 Y+ P1 F' I0 {# ocross_marquee.style.left=marqueewidth+89 W/ A9 Q' w" _% m3 ?1 w8 {
cross_marquee.innerHTML=marqueecontent3 G4 |3 G; R3 Y9 t, L1 m: H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 ?) o1 l& p% K: ~) r; [# U h}
: u1 a" @) x- ^6 k+ gelse if (document.layers){; S/ z. C$ b( b) @, o. q& S
ns_marquee=document.ns_marquee.document.ns_marquee21 w; f2 W' V$ ~3 y4 ]& s9 I
ns_marquee.left=marqueewidth+84 [; J: V9 r9 r( e4 g3 s* f
ns_marquee.document.write(marqueecontent)
3 u& V- r3 r* I) v' A1 D2 c9 Tns_marquee.document.close(); O4 O' G: E. e& k7 d
actualwidth=ns_marquee.document.width% y+ Q, `" n$ e& Q2 \; X
}
# p1 W" ]% w" k7 vlefttime=setInterval("scrollmarquee()",20)
; B4 ?; r6 F/ ?# Z1 o/ G}
& S5 \" |0 g' L4 S5 p4 lwindow.onload=populate
+ P3 ]( B& M. F3 d5 l1 v- j6 c9 q. b% U; J: g1 Q
function scrollmarquee(){
+ k) N" j/ j. W: sif (iedom){
. t+ [/ ~! V2 a% Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! w+ D* y6 _, A5 p$ wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 N' n) w5 |& H5 i E
else4 l+ z; j! J( ?5 ]7 C* \
cross_marquee.style.left=marqueewidth+8
4 t+ T' b& ^8 k; a( P5 M! s; P2 ]; T; q$ N% g
}
! C2 s! l* Q) M6 z+ `; Y, Yelse if (document.layers){
# Q5 }3 `, f6 }* I. Jif (ns_marquee.left>(actualwidth*(-1)+8))3 U8 j* {6 D: y$ K; J6 T
ns_marquee.left-=copyspeed7 f( X0 e0 F m- {) u) {: K- H6 ~5 J
else
1 S; P9 c6 N0 D0 D! }6 Bns_marquee.left=marqueewidth+84 z. `! i9 U- v, V- w _/ A
}0 @& G* q# |0 l: y# L! w- |
}. v$ G% Y" f& h6 Q
8 A# }; `- x1 M Z
if (iedom||document.layers){% s5 b% p7 y( k; q5 _
with (document){
! v7 q+ ~2 U. B" q5 udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! n2 S; t5 n2 E8 M9 _+ _if (iedom){. z" U; F+ h+ ~: {- ]% w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 g2 R+ u* _" {& `5 Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) a( x8 L- k2 Z) G/ C, k# q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% c2 i2 y( l6 W. O( rwrite('</div>')7 w' d S- T- n) Q
}( N- H7 \$ S5 i, L) D! J
else if (document.layers){) P+ L" z) j1 |8 M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 M. v; `$ A( d, m/ `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. r+ F/ ^9 }" h) U( S4 R2 M1 H+ vwrite('</ilayer>')
- j7 x3 Y) Q0 b& R4 ~3 r& C' F}$ f/ M' I: e! \% g* R1 }
document.write('</td></table>')
: J8 I1 m' _5 s}) e$ \" D/ i$ j( W
}
4 w, Z9 o6 O, ]</script> |
|