返回列表 发帖

网页之跑马灯文字特效

//修改宽度& r  N2 ?1 F3 \. i- I2 ~
var marqueewidth=300
# Z) o# W+ k2 |( Y//高度
+ r- @; `" N: Z- h+ |8 Zvar marqueeheight=25+ j! L9 F$ R" `4 p* [
//速度(1-10)& ^' x; y( @9 I0 U1 X8 I% ^. |
var marqueespeed=3
/ l& x0 w% v9 Z3 q/ l) N1 r//背景颜色3 `) |3 t! W4 [" v' t8 R
var marqueebgcolor="#FFFFFF"
1 P" m4 u. V0 R, ?7 _6 q//是否能暂停 (0=no. 1=yes)?8 H2 a# R% S9 r, @) \' H
var pauseit=1, V; {# K! e, \8 ]
5 U; D9 ^% y5 P6 I6 _$ ^% r
//修改显示内容
) |& ]6 W& e# |; bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 V+ _8 t4 @* ]& i+ I
2 k# M) o! N+ A3 W- O; q/ `4 `; G; c5 q5 A5 G# Y$ u- [
////下面不需改变////////////
% }+ \5 \* i" R# n& Y' |7 J* G2 g! E! \9 o3 N0 ~; q
var copyspeed=marqueespeed
% c. x/ G# p9 F* W7 z# b. Tvar pausespeed=(pauseit==0)? copyspeed: 0# N$ i- B! M3 b
var iedom=document.all||document.getElementById; L9 r4 w+ T( q
if (iedom)
" F# |! V. I8 t6 C. Z4 cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: G4 s5 b4 `- l/ g- Kvar actualwidth=''
4 D( ?# j7 K& p, c( mvar cross_marquee, ns_marquee
# }1 u/ O$ Q5 l0 M! u- g, A
& ?9 |* A5 ~# v. Y6 `function populate(){, u9 H8 B1 q' N8 {; F
if (iedom){
, Y6 z: w6 d! |, O; s8 across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 `2 B, q, {8 S5 `) h
cross_marquee.style.left=marqueewidth+84 Z7 W- g* p; E: @
cross_marquee.innerHTML=marqueecontent* }/ Z% b+ y5 w. Q1 {. m8 [% K& ?5 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" g0 o7 e8 l1 s" _% D}
- R: u1 E. l  r. ?# Belse if (document.layers){
6 U' T: n1 l9 h" B" Tns_marquee=document.ns_marquee.document.ns_marquee2
, D* W- z4 M' j2 p, X, z& Tns_marquee.left=marqueewidth+8
; r, `, D$ e8 }# \9 @# Mns_marquee.document.write(marqueecontent)# H0 ~* ~7 F9 K
ns_marquee.document.close()
" {0 |- P% W- U2 ^# Pactualwidth=ns_marquee.document.width
' T- v" f( K8 s2 f2 {. \}
+ [1 A: E# L8 Y6 L3 ^, blefttime=setInterval("scrollmarquee()",20)
" h0 A5 V, x5 g$ H8 f}% z3 v. u* z, O8 ~
window.onload=populate
1 o2 I6 r/ F8 a& N' N. C
* L  H" N. a/ F. afunction scrollmarquee(){2 q) u$ K& ?, g1 g
if (iedom){
8 @* g$ h$ P/ S- Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). ^" {- }# I2 s1 y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 s  o1 D* M7 R: s# @1 D
else
0 a! n- ?0 o0 H# I  \5 Hcross_marquee.style.left=marqueewidth+88 ~9 f) V, H6 S% ~* a

( j$ m- @# l$ X$ F8 q5 [& r}: Y% S+ O2 r$ @. y( A
else if (document.layers){* K8 [9 R, b8 P- u1 @
if (ns_marquee.left>(actualwidth*(-1)+8))+ }) T4 d5 E, Z1 B0 `
ns_marquee.left-=copyspeed/ p* b4 v% n, ~+ Z! \- P6 T5 T
else( a+ r/ g( f3 r
ns_marquee.left=marqueewidth+8' S: V2 T& U7 H: N
}  W# E9 x- B' v6 o. w
}
# B7 R5 |. K$ R+ p7 N) Z& Z
6 |" y/ c2 v% u! y5 P0 X& aif (iedom||document.layers){
3 T1 ~7 D+ @7 J. rwith (document){
( c, e$ b) M6 K. o9 j+ Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 ?# Z: _5 Q  h4 ~; N- o
if (iedom){
' ^( V2 f3 m) q, Q  ]0 `) T3 C% jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 A! c* h; Y* E9 d  Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% H& b2 _- b. I$ U+ ^0 F$ U7 a
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& S3 M: t# W! j0 l! q  }  owrite('</div>')7 D, a. r3 L+ t8 l# K5 q
}
/ f+ _( F" _0 D8 X& Ielse if (document.layers){6 x/ _/ p  D9 C  }. X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% s; X$ F" I- m2 m! L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 K! b, }! V' S/ D1 i' z. s# W
write('</ilayer>')6 r; d' o( T% u+ W. T4 A& V) [9 L& U
}
  \1 D( g% r/ ?. {document.write('</td></table>')
% _( H+ H+ Q: Q" q& j! F}
0 u; b9 b. U; s" s}
  a0 G2 e3 `6 D& {' H</script>

返回列表
【捌玖网络】已经运行: