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

|
网页之跑马灯文字特效
//修改宽度
! [& \* p$ w: z3 xvar marqueewidth=300
' _5 B- k7 i9 b/ }- H0 t3 I! v1 A n) D//高度/ s9 [2 J' @3 k: W7 j
var marqueeheight=25
+ c2 n& ~7 j& }$ r$ L; ~//速度(1-10)
& Y+ f M: `/ u! |' Wvar marqueespeed=3
. j- N0 e2 [" c5 e//背景颜色0 V( f! Y3 F5 Y0 X0 V/ ?
var marqueebgcolor="#FFFFFF"7 K" A( Z2 @& C
//是否能暂停 (0=no. 1=yes)?- X1 _. o4 t1 O. w1 ^5 h
var pauseit=1# X+ r; ]! L" Z7 i0 a9 I
1 ^6 B* E3 y0 Q5 K; ]
//修改显示内容% e' c/ {3 `5 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 \4 B1 V* ~6 ~! \. C. r
, q* }5 j$ ]6 h& F- L- j& d" j* O! S
////下面不需改变////////////# x- n( u% T6 x! l( c8 d/ }! E
) M1 a/ k) u9 e$ Z5 p- t$ C/ zvar copyspeed=marqueespeed
: E E2 B' S& [$ _9 l" Gvar pausespeed=(pauseit==0)? copyspeed: 04 ?' v& E& |/ s
var iedom=document.all||document.getElementById" b" R# g6 t& |4 ?4 t: q
if (iedom)5 q/ [. F2 w0 o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 q8 H. j6 Q, l1 _var actualwidth=''
$ A. @, s) Z, \6 Bvar cross_marquee, ns_marquee5 T; w+ e- d: A- F
% V& N9 a' Q& w. C7 p3 e1 ~3 `4 m X
function populate(){
C, m6 \. y, t" B2 o- Jif (iedom){( b5 j+ W0 ~* b3 _& Z' Z- Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! n% E$ c2 V2 O3 U: `4 xcross_marquee.style.left=marqueewidth+8; _7 F& N+ r+ [, M i9 ^5 f( L
cross_marquee.innerHTML=marqueecontent, O) ~7 j. r% V& i2 Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 u) f; z; o1 V# D}3 e' j. l, }, R# S2 J4 U4 `4 ]% |: u
else if (document.layers){/ p( q5 l, r3 p- o9 I: s$ y
ns_marquee=document.ns_marquee.document.ns_marquee2
n) z2 g0 g: vns_marquee.left=marqueewidth+86 J' I8 Z$ W1 B1 ?/ U# g8 ]$ n: V
ns_marquee.document.write(marqueecontent) N2 u) e+ H: E7 i. d) ~( J
ns_marquee.document.close()7 |+ i8 q$ P- s
actualwidth=ns_marquee.document.width
1 M+ } C- e, T# O; m/ o: E}
3 t) m" ]' o* r l) plefttime=setInterval("scrollmarquee()",20)" Y8 A* V1 z5 P3 ~. k3 |. _" K2 r& Q+ \
}
# C4 w- m( U! ?" _window.onload=populate
% `' H- F& V1 ?. f3 E
1 p5 ~7 F d+ M! B Afunction scrollmarquee(){
& I+ @8 w$ Q1 m' _, Iif (iedom){4 x5 |% ~: ^# R( T- [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 c- z- j o o8 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. h. F$ t3 ~4 z. B8 S: P- T3 v$ ~4 Uelse) S" Q1 q, \1 y( v6 H4 Q
cross_marquee.style.left=marqueewidth+8' S# h! `$ q/ c" z& X7 t# R
* }( F% j* b2 y6 e. _6 J
}
5 e: {4 m' F8 C" Y0 U9 Velse if (document.layers){' g0 q# S; j' L* I) \8 H" z
if (ns_marquee.left>(actualwidth*(-1)+8))3 C, {6 F/ N3 {8 j0 H' R
ns_marquee.left-=copyspeed% s% K: }3 C) [
else
$ k# A. y) Z3 H U! ~/ nns_marquee.left=marqueewidth+8- V4 U% G" g& r& u- J
}
! y7 R* q! L) R9 c$ w+ x( h}
) e4 a! r" f! B- k" [$ ?3 A$ g. s6 c
if (iedom||document.layers){# l6 K. m, i0 d e- S; a E/ D
with (document){3 I. B, }8 B- K Q+ v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 P) O5 B1 `# Y1 a9 N* e& i! B$ i7 ?
if (iedom){
3 @* h, I4 |$ C& @/ hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 u8 B5 L. o2 I y- [: A; n1 wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& G, ~4 q# m2 A; e5 owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 W8 e/ r+ ]$ H* s2 W0 ^. N* d. T
write('</div>')* \8 o* ^9 m5 w2 @
}
2 L3 w0 l- e, M( Qelse if (document.layers){
" E4 q2 g$ H2 |. _( a$ U% J5 e5 Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ O7 H/ {4 e( A" xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') y! U( a' g+ ~8 U7 U
write('</ilayer>')
3 B) |& j+ D; N; H1 n# e8 H}; H! S9 \. D4 v* \5 M* Q
document.write('</td></table>')
1 H* h& k6 q7 T7 y}9 h$ v- N/ B0 k. ?3 x) D0 K
}
& l& Q# R' T2 _- h</script> |
|