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

|
网页之跑马灯文字特效
//修改宽度! c' r$ q4 ?4 w% j& E, g
var marqueewidth=300
; t! ?) b% v6 ~7 @//高度
: t, T9 N# r% \% ^- L; \; avar marqueeheight=25
5 g! D, s% `% f( r' x//速度(1-10)8 {% P8 A& X9 d5 P8 I" Z
var marqueespeed=3" {; \# u4 H1 i# a+ g8 `" S
//背景颜色7 ~- f) h. m1 J
var marqueebgcolor="#FFFFFF"& Z' a1 X) e4 d/ G4 m6 u `7 j
//是否能暂停 (0=no. 1=yes)?
' E+ u/ _8 a2 y) [% J. T) \var pauseit=1! N% x3 m+ s* p
9 w( O1 W5 f1 ?6 G! ~6 T" v# W//修改显示内容# t) Y* u$ m) z) p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ B' N h2 \; V; |7 B
2 z9 R* @$ G' j. f" ?
7 e! h) D9 D# n5 R) }////下面不需改变////////////
7 s1 a$ H( H, I( n5 M6 |4 u3 |
! I. u5 l. `" c% Zvar copyspeed=marqueespeed8 ?8 {/ ~8 ], P# |% j& q
var pausespeed=(pauseit==0)? copyspeed: 0
* E' x$ ~! g9 v) L. {var iedom=document.all||document.getElementById7 {0 x. V" X' @: E6 X
if (iedom)# X# M, ?6 ^0 N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 `5 d1 w" P. c- v# t. ivar actualwidth=''. F( w) ~, `& @/ ^! g. w4 y0 D6 ~
var cross_marquee, ns_marquee. A* M! Z1 [0 p" g
8 b) F" G. a' r* r! F
function populate(){% V1 G7 p( P0 a ~" B4 R
if (iedom){$ M% O* t% G0 g6 L8 i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& r; y9 M) w( Z) f/ Xcross_marquee.style.left=marqueewidth+8: Y5 X4 Y5 ~; |9 h# }. h0 N9 ^2 \
cross_marquee.innerHTML=marqueecontent
9 ~! [0 @/ \" Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% a5 |% ^1 j9 R
}3 n& G( T: N) g& P9 }
else if (document.layers){0 m6 ?- n9 ~7 c$ A$ g
ns_marquee=document.ns_marquee.document.ns_marquee2
% c( l8 P8 L% a% n5 q5 Yns_marquee.left=marqueewidth+8. f& K Y- i$ z. j. Q; a
ns_marquee.document.write(marqueecontent)
' s4 R0 H# N d9 Mns_marquee.document.close()
! w) N& z5 }# h8 C8 K, Bactualwidth=ns_marquee.document.width
: ]! O" ^0 @# G1 d; _}
$ A' R. q% c0 n# P# Z8 E' _" xlefttime=setInterval("scrollmarquee()",20)% C8 m8 Z5 I( F# Y) x* _8 H$ M5 P
}
; k- ?9 H1 z0 m2 Ywindow.onload=populate
3 c$ A4 `1 }+ T6 H1 ?, I" R1 u; y2 p' w
function scrollmarquee(){
9 e& `# t$ Z: t% V; t' tif (iedom){
1 G0 H1 J. M: ~& f% j/ Z9 a8 Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& W* a( r/ t: D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 y/ |0 x% Y: d& h6 D
else
7 M- _% |, M; U+ C& ~2 }- a6 Qcross_marquee.style.left=marqueewidth+8) p6 j2 J, X/ N
# {! g, k, {. Q, S! X9 a4 Q}, O) L* z$ T" }! t
else if (document.layers){
' t0 Z1 k! z5 x) k1 ~* Cif (ns_marquee.left>(actualwidth*(-1)+8))2 N/ J9 X" J6 r- f' S$ R
ns_marquee.left-=copyspeed& _9 t+ b- ]% E3 |; O( f
else! A" L- r) Q4 C# H0 M' e
ns_marquee.left=marqueewidth+8- q! {! @' b) x% }4 q, m+ x
}
9 ~# ]) |2 A2 q) n6 y' K% j8 {% A( ~}
) s9 M, V1 c- ~# G6 P
/ \2 E& K$ |1 O3 Y( [$ Kif (iedom||document.layers){
8 d. t: L. E1 o) \% U/ `. Z% b. mwith (document){
7 t ?9 q- W3 {0 D7 d. H9 {9 B$ Z. j/ Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 Z+ Z* d& K" h% y5 `& Q$ lif (iedom){9 E) a/ t' D. i6 ?4 P Z* E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 A. J9 D. g3 o7 o1 ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 o# k# p! F5 G# ]; C+ w }4 b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 `% R+ N" v+ T5 A" @# P( T
write('</div>')
' P7 y+ Z2 L1 k' N}4 q# D5 X, Y! M7 F1 Y" k( i
else if (document.layers){
2 s4 G1 L Z7 x) o" m3 |! n/ b: `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 U4 i7 t3 C' G9 ?3 d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 Z' N, [! e+ y- R: O5 Twrite('</ilayer>')
5 u# p5 }7 [- b# A}
' O! e$ b% B2 t: x$ ?1 {document.write('</td></table>')
" n% K" i- u7 K& u @}5 p2 o4 X ~% E/ L( @4 v
}
/ l3 B. p0 H# R) v8 a' E8 d</script> |
|