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

|
网页之跑马灯文字特效
//修改宽度' V O0 j! h/ x) b1 q( e
var marqueewidth=300
7 M7 W: \, E7 h% n, f! O: g//高度
6 S$ Q: O6 @! i2 Z* y7 ]! ?+ g* n/ Tvar marqueeheight=25
! p" h/ v, Q- c2 o1 g5 w0 k//速度(1-10)
' ~1 I! i, g' ^var marqueespeed=3: L/ Y$ l: @5 h& a
//背景颜色/ |$ [! f H' G' t$ t! \
var marqueebgcolor="#FFFFFF"& ]! c- Q1 A& J& F4 n- \
//是否能暂停 (0=no. 1=yes)?: W; v& }* W& l9 Y3 v# l
var pauseit=1
3 J- j r5 E5 h. x C% g/ M0 t+ |/ G; y' ?9 h6 G
//修改显示内容
8 z; v9 B' D/ a1 K) f9 pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; q1 c5 S: W/ j% `
6 ?4 r3 V5 t) i: e7 B8 O1 t
' P: o C. f( x* c% q3 u////下面不需改变////////////+ b- C* | K( }+ F5 k3 ~- d, h
2 d3 X% d o& {* b3 _0 l
var copyspeed=marqueespeed
- s1 D! Q. |" I9 Qvar pausespeed=(pauseit==0)? copyspeed: 0
j( r( M0 M' b7 F0 S! g" Uvar iedom=document.all||document.getElementById
/ Q q5 I6 p2 B$ S3 Tif (iedom)
$ y% g8 e3 s5 f3 s4 zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 a7 {* M# {% T
var actualwidth='' V, r2 K+ ^' x w- V. g6 T: F5 W
var cross_marquee, ns_marquee
5 ` N4 M M9 j! p% g3 j' r0 ~% D$ s7 k' z, Z* Q* c g
function populate(){7 @" H2 k/ Q4 s" B& j0 q
if (iedom){4 J+ u& u* I6 [% K: r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" w# S6 A. g$ A9 i
cross_marquee.style.left=marqueewidth+8! f: }$ X5 o' Y9 @: l- s
cross_marquee.innerHTML=marqueecontent
+ x1 M- p3 M- K9 P o9 cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' g& h+ o+ R* S- i/ M}
) T7 h& W$ Z5 J9 `9 _3 O* X4 \else if (document.layers){
( g( b5 X& l: ~8 Q" @* o' Hns_marquee=document.ns_marquee.document.ns_marquee2
' d. X6 @) F2 p4 }ns_marquee.left=marqueewidth+8
8 k: C! y7 k7 R: N0 [ns_marquee.document.write(marqueecontent)
3 E- N& @) [$ a+ _3 w1 H7 L; D xns_marquee.document.close()
; |/ ^# y* {3 E5 gactualwidth=ns_marquee.document.width
; L2 T% R+ F) [% p. e! ?}
$ B h0 a! Q7 t t5 Plefttime=setInterval("scrollmarquee()",20)
5 O3 J- g( I8 w. k; {9 F1 G; O}
; d! b- u, m8 l- ~5 Bwindow.onload=populate4 z! _/ E& }" C; G
' Z: b0 N6 ~% H8 |" t; q- Ufunction scrollmarquee(){
" u h% Z6 ]$ S, x% bif (iedom){9 C3 X: O6 g/ \$ a& K. w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 W) T& ]% L! M4 z: y I. |) Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed r: z' N/ w0 I" O# {4 t0 z
else7 t3 a0 J6 X9 ]. q, o
cross_marquee.style.left=marqueewidth+8
3 X# g# v7 k5 N$ _
" u) Q, c5 B# I) D1 Q5 O}
8 X% g( G2 s* v" G& t7 Y* ]else if (document.layers){" s( o6 s8 F+ x; B& x
if (ns_marquee.left>(actualwidth*(-1)+8))' l; r y) h6 O9 [, e* Y% I$ W( i) Z3 e" }
ns_marquee.left-=copyspeed8 x+ B: Y7 ]; D! l
else
/ g- J8 j1 i& L4 l6 M5 fns_marquee.left=marqueewidth+8
2 j: B, Y1 @# X! G7 j/ R! D6 {}3 S9 T- p( G* ~$ r1 ?. A K
}5 v5 c( o& R( O7 Z7 B& p
+ s: E5 Z" I, B
if (iedom||document.layers){
& q% Z* r3 r2 W6 v6 T: p( swith (document){. Y" p6 K9 A; e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! P0 Q3 ~1 D' {! v5 L# F
if (iedom){, ^6 _6 N& j) g, ]6 q2 m+ p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 v- }, |& H9 { _) Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& F: P9 Y9 n* E4 `0 @, T6 W2 Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! k. g) l# ?7 }' V3 H6 c) W7 e" fwrite('</div>')
* B# F; V) n0 G$ Q+ m}6 g% s3 n v6 m, H; w
else if (document.layers){4 ^+ i# b5 b& L3 B2 j: v- T3 X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 n, O/ c& L Y1 t0 B# cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ O8 x8 [$ C5 @; p( Mwrite('</ilayer>')
3 N c6 r- D6 ?0 n}
7 y7 H; m; s, P2 idocument.write('</td></table>')+ J4 r' U" A, t! M: t
} |5 a- y3 f b, C
}# }8 p7 d2 K n) k( T8 U
</script> |
|