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

|
网页之跑马灯文字特效
//修改宽度7 V! j9 h. Z, x' q; G5 p
var marqueewidth=300; v9 M" v1 ^ ~* B& H0 o2 G {
//高度. Q: k; b1 L, ]+ K$ q t6 u
var marqueeheight=25
" u: w* }, _ Y7 h7 z" _$ M; H//速度(1-10)
9 q# A0 o/ F0 q; W3 u5 kvar marqueespeed=3% ]+ ~( W( ?9 z( O. c$ c* Q* n c
//背景颜色
6 E! `4 Z Z- Z7 ^8 {var marqueebgcolor="#FFFFFF"
& u8 q1 `; v/ o+ H, f( F//是否能暂停 (0=no. 1=yes)?
% Z/ B2 H+ A0 E. c6 C% jvar pauseit=1, o7 |8 Q% E& e. e6 }
8 S7 J( e5 }3 E* W, c//修改显示内容" L% T& A* l8 e# f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# p8 X, E& i7 @; k+ L! Z
k0 O) o4 `) i: B8 c) s
) O# M- H6 l- x////下面不需改变////////////4 h* n* `. q3 y* } w. \, a) o" L
. V* |' @" Y( t( C
var copyspeed=marqueespeed
0 [7 h3 C2 B" v5 n" m' jvar pausespeed=(pauseit==0)? copyspeed: 0
u9 N& W& x& B5 r' P' o: Lvar iedom=document.all||document.getElementById) P) @* c2 M6 R
if (iedom)9 B F7 K u: N- _. S8 ~7 W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. h6 ]6 I: Y- n4 |3 r& Hvar actualwidth=''
6 m8 r( v! M3 U# \% N( t/ xvar cross_marquee, ns_marquee
5 z6 J( V1 c5 G% m; G! v+ l8 p3 q. K% @ a, P
function populate(){
5 I4 d; u, n m9 Jif (iedom){
0 F" l4 W& E6 m0 L: Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* c& q5 I6 i' R: p. e" R
cross_marquee.style.left=marqueewidth+8
7 ]4 `2 U+ h! s' V8 B, i4 gcross_marquee.innerHTML=marqueecontent
1 R2 l- D7 g) ]4 v# W9 r: Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( x) p7 T5 _& z7 r( b}0 E" s; C5 M" F6 ]
else if (document.layers){; X. i5 r' S. @* h, H
ns_marquee=document.ns_marquee.document.ns_marquee2
5 K- ~* \* |4 N% pns_marquee.left=marqueewidth+8
- N2 R1 ^7 K/ E9 U9 wns_marquee.document.write(marqueecontent): N; O* y# J( d" z; @
ns_marquee.document.close()/ ]1 }5 O% P' G: I$ k/ S" ^) j+ F! O
actualwidth=ns_marquee.document.width
; t* q/ W) }( ]' [1 Z2 B9 _}' A4 R0 O' g1 C4 O$ v/ ~( F
lefttime=setInterval("scrollmarquee()",20). u; o. {) W4 F" _) i! f2 h
}0 ^$ ]+ h) B- u' Z& E
window.onload=populate
. l# W* H# v$ |9 h5 D
6 s% o8 ` K0 Q! ?% _/ P/ [function scrollmarquee(){, X, R& f. E/ G: z4 |( s
if (iedom){9 p5 {* r: A. U- j. v5 ~4 b
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): p- s5 ]# q U! O5 @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ u5 G5 w: c2 K( \% n
else
$ T1 }& G4 ~ `4 pcross_marquee.style.left=marqueewidth+8. L# ]5 ]) b: w V
. c9 |% e1 l' @1 K}. {* I1 K* U# \6 Q. n5 l4 b3 U; j: r
else if (document.layers){
& C' `7 v% d6 `8 eif (ns_marquee.left>(actualwidth*(-1)+8))( M& X9 }% ?" e
ns_marquee.left-=copyspeed' j% V( u2 D" l# O; R5 n$ |
else
9 m& R3 ~. i @8 F1 a" cns_marquee.left=marqueewidth+8
* w" _( F; G: t: c& x* `! }% J}
3 }% }+ X+ Y# ]$ a) D" {}) v9 Z' |8 y5 z; _/ E
4 ]2 z7 }/ E! ]. C# j, }* dif (iedom||document.layers){( Z, z* J- B# H+ S
with (document){
1 M b3 _" f7 adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 \! F0 [$ l4 i. l7 C
if (iedom){: t/ _$ f$ e" @, ?5 ~/ G1 D; ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" i+ g8 z, b6 d& Z! h7 X9 `) X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 h* A! O4 u2 ?8 S8 z) G8 _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. O- A! p" e( gwrite('</div>'); r0 W& j; ^ \8 ~9 V
}
9 o `. D4 A% N/ o" V% _else if (document.layers){
; t4 u+ T( p5 ^* e4 kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& t; w$ @+ {! gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) ~+ F% \# T* V* d) A* d8 L
write('</ilayer>')
6 u) A2 g. c- x( N% O7 W}
% J$ K8 g" R4 ]9 ydocument.write('</td></table>')2 I2 E. x' H. t8 A6 A& \
}
" T- X, d2 w7 ]6 B; E}
$ ~! z; r' x& c( P</script> |
|