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

|
网页之跑马灯文字特效
//修改宽度- E+ P$ T" U3 m" C ^
var marqueewidth=300
6 L0 x P) w3 P# d//高度" L7 j! k3 i9 M" G
var marqueeheight=25/ E! F) D! I" u& ]
//速度(1-10)$ B# u; }* F$ s! Z/ G
var marqueespeed=3
1 s7 a0 c4 B6 R; [- E//背景颜色7 U, `* u6 C4 M( v
var marqueebgcolor="#FFFFFF"
7 b% {. {1 d/ y8 Z7 n( l//是否能暂停 (0=no. 1=yes)?, ~0 P$ y) [/ }( _8 M' F
var pauseit=1
9 u. ]2 t* u8 b6 w( C
1 o2 u9 n S4 u# I: Q; y//修改显示内容, e( X* E M1 V( K2 {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ |( A+ Y- n( J* z
. w+ O! u w' R* [/ ^& |
. O$ p( o9 ^# A; U7 V( U1 n9 N////下面不需改变////////////$ n/ b/ l, e4 }9 \! u' `& W
1 Y( Q$ |1 t! {- N
var copyspeed=marqueespeed
+ T* |/ I" N2 ]" m0 f" Y9 ovar pausespeed=(pauseit==0)? copyspeed: 03 a: B# w* {3 |6 Q: A
var iedom=document.all||document.getElementById
: U2 Y8 J9 [5 ~if (iedom)7 ~# m1 k9 c4 S7 s$ e# H6 X5 W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' u9 m# I/ G7 Y X, Pvar actualwidth=''
" y7 b% n* V q& p9 uvar cross_marquee, ns_marquee: q1 f9 t1 I& I! t1 q
, o6 ?) l- t4 L8 x2 L# b8 Wfunction populate(){
2 h2 S% p; x+ A* N5 Z9 Bif (iedom){/ |% Y3 m) w4 o! O3 ^& `( c. N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 b% W, u' c1 V+ J/ _( P% s1 f& R
cross_marquee.style.left=marqueewidth+8& j; i' E7 N0 @8 m/ v: I) @; A
cross_marquee.innerHTML=marqueecontent ?% |0 t- _+ ^! A3 K* _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: W3 P) v) W6 D6 k
}
5 z- M2 @3 b( D6 l8 belse if (document.layers){
) {4 B+ P0 i- P$ f) X+ ]ns_marquee=document.ns_marquee.document.ns_marquee2$ ?9 L! L# X8 M: ?9 m' |
ns_marquee.left=marqueewidth+8
. L1 [$ H9 | Y# A4 v0 I2 W' G. ~ns_marquee.document.write(marqueecontent)& _* h* E/ J0 L) e! F: ?
ns_marquee.document.close()
3 |. n% m2 a2 _$ K& B4 u- Zactualwidth=ns_marquee.document.width5 D I( i; n6 K/ @$ b e
} K+ |9 A5 G5 {$ C/ Z
lefttime=setInterval("scrollmarquee()",20)+ O7 Z w* _, Q$ N. J
}8 l( C; a5 g, d% \" Q& E
window.onload=populate
& x& ^, |4 c$ C3 a$ s+ j- b
3 i$ K) b1 O1 T: N$ Efunction scrollmarquee(){
; l8 _2 Q4 E8 q w) w% K+ mif (iedom){. \" o. c! t( |; @: H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ y1 I( o& h3 A$ @' N( w4 \. U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# q+ y% O* P* p3 P, d$ }else
/ p2 F. d* o% Y$ ^. F8 ?& m+ h% rcross_marquee.style.left=marqueewidth+8
5 U! M0 F' y+ B- ~% Z2 |
* H( ^1 k$ C9 W$ r1 C4 }}3 ~; G/ u5 [) @. D3 D4 c
else if (document.layers){
+ Z- l( }7 `4 m' x9 Dif (ns_marquee.left>(actualwidth*(-1)+8))
5 q5 y4 e* g! a" B# C0 u- @ns_marquee.left-=copyspeed
3 I/ V/ q. G0 U, ]6 Q4 V. Relse9 i$ D: H% }0 v' ?# H5 `3 t
ns_marquee.left=marqueewidth+8. Q1 o3 Y" c& u! V/ K# \5 b" v5 f
}1 s" H( p" ]& F
}
/ P* |/ h7 A7 l. k! s
' |/ @9 D5 K! W; ?2 hif (iedom||document.layers){
2 ?% O5 @8 W/ i4 P+ A: cwith (document){
5 }: j% D7 X/ A# i( ~2 W; h x: vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): Q2 M( t3 J4 \% B1 V8 N/ X
if (iedom){) Z& r, ~8 i P8 u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 P0 t) f' r! b! L$ y% |" n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 x& h, C/ X* X+ C* W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); k9 T- v& d* s7 c4 S
write('</div>')# H' V) X& t' I0 c v" L0 M7 C
}$ `9 k. k2 M; y) O' t4 @
else if (document.layers){$ R0 |5 D, r5 {5 \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. r. f1 ^- ]; b1 g1 a% T2 g8 c* Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 I! k, t0 E$ |5 a% C
write('</ilayer>') c; f/ k) ^2 A' ?) C
}
+ N0 o) N- ~! [2 {2 Wdocument.write('</td></table>')
1 w! O) t6 J' N( ` w( }}$ V* Q" n) o E
}
1 T, M0 o' O$ p$ w</script> |
|