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

|
网页之跑马灯文字特效
//修改宽度! ~7 P' o4 @/ W5 P; A; b$ ^
var marqueewidth=300
1 n2 ~: ^( f: r( D# T0 ?5 Z P. Y//高度
; H0 H+ |6 P0 K1 evar marqueeheight=25
1 B/ {' o" A" R//速度(1-10)
5 x+ A! w+ v {. ovar marqueespeed=3- h+ J* R/ d; Z1 ~. N d' q3 @
//背景颜色
) U- M+ |# G, ]/ R( V3 wvar marqueebgcolor="#FFFFFF"
. u) [$ j, D* z3 b1 y//是否能暂停 (0=no. 1=yes)?
& G X ]8 ~( L8 ovar pauseit=1
( \& k# Q6 B2 A* k5 o7 f6 a$ `0 S9 P3 C1 n1 e L# B
//修改显示内容8 I( W. f0 [/ q* `9 ]3 q f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 r: L5 a, U( p( R1 t* R
. b# g7 }/ ?6 A- }3 X! ]; r! m8 w5 r* l0 c/ @6 i; s F7 r: @
////下面不需改变////////////
; _' P$ s3 m" b4 ^+ i8 l9 G& b
; N0 ~5 o, o6 l; E# j. }var copyspeed=marqueespeed
) Y0 b4 \5 x! z% R+ C% rvar pausespeed=(pauseit==0)? copyspeed: 0
, j, `; G6 a4 u `& {var iedom=document.all||document.getElementById
( W# y1 b5 p' uif (iedom)" v+ `8 n2 `5 p* v. }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 G; r4 D% l9 |3 i( tvar actualwidth=''
7 u2 S$ f3 O7 H+ _! J) Kvar cross_marquee, ns_marquee" _' a' }6 X0 V
3 a% \& U5 }1 h: \* A! y+ T. K8 e
function populate(){
* z7 P; g) @4 E) e9 f3 Z8 Tif (iedom){
2 v0 v( g. r4 C: A0 X' [! |( ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: b4 i6 Y7 x0 u! g- V; F% y
cross_marquee.style.left=marqueewidth+8$ C& T3 ?' b, z F
cross_marquee.innerHTML=marqueecontent9 U, q ?) e" i* s9 m$ d# {( j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( U7 B9 u8 E: N& ]) q" n" k. O, {
}
% }' o8 ?) {/ l1 a+ ]2 h6 zelse if (document.layers){
. b ` M2 k! I$ D0 g2 ens_marquee=document.ns_marquee.document.ns_marquee2
5 f9 J. V" v7 J, i8 ons_marquee.left=marqueewidth+8* P# ~6 n. k) y
ns_marquee.document.write(marqueecontent)
0 V" `( q* X) [( qns_marquee.document.close()
) b1 Z- y0 X4 R! jactualwidth=ns_marquee.document.width% H9 Y+ N6 R: A# P- N# }: y
}6 g3 v) _$ B$ I7 `' s m7 s
lefttime=setInterval("scrollmarquee()",20)
D% T ?; u, K* m- U7 K. |1 _}
( \6 Z8 V& l4 Z. ~8 L# N0 x2 wwindow.onload=populate
5 v- Z# H0 \+ ^) a
. t0 Z# K" H8 f4 ~function scrollmarquee(){& C' G7 `7 Y1 A/ b* A" v
if (iedom){
0 J# L; Q1 X, Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! ?9 o$ J$ F7 E1 L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' B+ \) z) G c* g: |
else
4 H' W* W2 D& ?3 V& D* ycross_marquee.style.left=marqueewidth+8
8 f( W5 Z; _: r3 f. @' |' n
6 \3 N6 O4 z' W# g}# b8 A' b4 i% O" j/ e) Q! G
else if (document.layers){/ C/ j4 r9 L2 T& n/ b! P
if (ns_marquee.left>(actualwidth*(-1)+8))
& S2 n2 S2 O+ u, ]5 _4 Zns_marquee.left-=copyspeed
5 V$ ~. H- x8 z7 W: Eelse
% A+ E" n/ q1 W% e% O( X$ Tns_marquee.left=marqueewidth+87 y+ [* s+ F; ^ k4 e4 w! ^
}
8 W7 u1 N# i, R9 c3 |}; F9 o; _0 q3 Q
$ r( A9 g s/ K7 s$ Mif (iedom||document.layers){
% D" e& P/ P; _- Jwith (document){3 P# B5 N; k+ ~7 w( b% ]' [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 x$ c6 O/ i+ \1 R0 {5 E
if (iedom){* q$ ~: X( L3 M; G1 Y# I* m; k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 n- Z0 @$ _; s& r7 m9 F1 ?- R& N1 \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" P: Q4 v: e( j" ^+ ?$ k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 l& B& W( ]% u7 f
write('</div>')
/ X: b$ g/ Y$ o( K+ j' D! J}
- k6 ?. S+ |3 `& L/ L& yelse if (document.layers){* V0 ~2 L c/ |' X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 t" }7 _; s; `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( ?1 ?* C( M2 e7 S8 l% R+ Swrite('</ilayer>'); G! N0 E! _- a* ?, q
}* X0 L, b0 i, m( L" P* k
document.write('</td></table>')& ~- u6 h4 n8 o! `0 c2 X) l) h- c( v# Q
}# T3 G: v; A6 ^# ^* Z l! u/ K0 X
} M6 f/ `) g8 d4 S+ L/ o
</script> |
|