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

|
网页之跑马灯文字特效
//修改宽度
/ d# D/ R/ s3 j, m1 R, u$ pvar marqueewidth=300. I& V- d) u1 E1 V9 O' {
//高度3 a8 b8 n/ P9 ^7 v; @* f' ]
var marqueeheight=25
# P/ t# Y9 K" Q; f' o& y& j//速度(1-10). ]' E E: @9 e3 M) e3 u) Q7 ^- a
var marqueespeed=3& P3 F( `$ D0 ]/ u( ?
//背景颜色
8 X* I* U% O* W0 Y# qvar marqueebgcolor="#FFFFFF"
1 F4 m6 P: k+ u- d//是否能暂停 (0=no. 1=yes)?
8 V) k- s/ v# W$ d# u5 Y6 y N# Kvar pauseit=14 ^5 L5 i& r& j1 o; u
2 S8 y& P) `( I6 w7 ?$ J, I4 A! ?
//修改显示内容( T# J4 n, Z- T' D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; n; s& Q8 f1 ?) K
4 O- ?5 D, k% O! m; v1 e3 M7 m6 c3 Y0 D& q
////下面不需改变////////////" i3 r) W w6 l# T0 N" k
A1 A( ?, N, tvar copyspeed=marqueespeed
) w3 n3 S! o/ I" X# |% r. \2 Fvar pausespeed=(pauseit==0)? copyspeed: 08 s8 c4 [* D+ C, p' S0 A) Q! }
var iedom=document.all||document.getElementById% L/ D" h+ N6 r3 V) U" g: C
if (iedom)
8 a5 }" V) d) _' w5 M6 D3 `, Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 ~0 O) a- Q, t0 D% N
var actualwidth=''
2 D" p6 f- w2 Avar cross_marquee, ns_marquee
& k4 H! Y w0 k R
- M6 b$ Q E# wfunction populate(){( r* z, [5 m7 ?1 @
if (iedom){
2 M6 `/ \7 z Z; d6 w( Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% T, X4 y A8 m( n) K( x( J
cross_marquee.style.left=marqueewidth+8
5 N. C2 V2 v" U5 o3 A* G, ^cross_marquee.innerHTML=marqueecontent
9 V8 t/ u9 T- x# R% o* g! iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 y. R* P6 S; O5 \: }" R, ]9 z
}# c6 r! ?4 p2 S9 I! Y( R
else if (document.layers){
% D; F! u( l. e1 Mns_marquee=document.ns_marquee.document.ns_marquee2
5 y3 H# X$ ^0 s4 b$ g, Lns_marquee.left=marqueewidth+8& @: |3 r. j2 D n
ns_marquee.document.write(marqueecontent)% j0 e' A) j* y
ns_marquee.document.close()/ ~3 t! x6 \) |
actualwidth=ns_marquee.document.width
! L2 r, s/ |. ] H6 h' R3 U}
6 ?2 n0 h V6 T0 B( i' w3 g8 Mlefttime=setInterval("scrollmarquee()",20), ]3 }/ k/ |0 b: |5 M
}% u- n; E. H( p0 [, S( ]
window.onload=populate* z! U/ z* c2 T1 t
$ R ^) M% A. A, O2 E$ ^2 Gfunction scrollmarquee(){
" i& Q& \/ J, ^% t& v% J0 y& Eif (iedom){* p; R8 [* O8 I. ]2 L3 I# n" w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 {" B" `# E7 A% hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 o1 s, \+ Y; h* m
else# X W4 e) g+ |. k# Y
cross_marquee.style.left=marqueewidth+8
& ^2 V, r9 d, ~/ z# B9 R
, M$ s$ R7 q3 ]7 D. R3 W/ O}* S4 X, B; |+ I0 R w
else if (document.layers){; N$ Z% q9 z, J! K5 y# c* E
if (ns_marquee.left>(actualwidth*(-1)+8))7 B% G# }$ [6 t/ C+ }
ns_marquee.left-=copyspeed
. I2 S: D% |3 I) \; N" U; velse1 Q! g9 r. R; M6 y
ns_marquee.left=marqueewidth+8
3 p& k" e; a$ a2 W" j; @}
1 C8 T* i# f- {! f' A/ Z) i, P}
7 a8 Z- l/ g. O* x1 ~; \9 e( a; K/ w& c" h* d1 X: V
if (iedom||document.layers){
/ `' g8 D) d8 v% H* ?with (document){
! D) C" L8 T, y" g( M8 G; r7 odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 V- l- V/ x2 z- V6 I7 ?+ tif (iedom){2 P6 R& v) x; S: a* z+ S2 \5 }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& P+ a- u7 X3 U8 A5 o e: Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) T9 @6 p2 f# b2 I8 O" T3 mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- ~- v0 e. [( w; Zwrite('</div>')
9 a8 P! ]( @; I2 ~) g}
; ?: j, R& H* K; p; w: nelse if (document.layers){6 w& A+ }" V: Y; G- b6 f1 x* n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 ]& s- f) `, M1 awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, G# P k6 u6 `3 O, L/ p1 Pwrite('</ilayer>')
; e# J) U5 n, Q0 o) x+ ]/ {}
" B& H2 F, [$ y( I, E7 zdocument.write('</td></table>')- z2 d S: Z+ W* x Q. C& C. M3 ^
}
* s% R% T3 h* J: C+ e! j9 x2 ]}/ @) p! F/ M4 ]: u T
</script> |
|