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

|
网页之跑马灯文字特效
//修改宽度' a7 R8 C. c" M& O; G5 q( N' c
var marqueewidth=300. Y" P/ T$ L6 J. }; F+ M" l7 c
//高度
V6 H0 [, b& j+ j7 L1 evar marqueeheight=25 Z" o: _: n( n! o9 @, S9 M C3 N: ~
//速度(1-10)
0 g4 p, i4 k) m% t$ F6 A2 R- zvar marqueespeed=3
& H4 F' N3 D' P: j- M5 e, s//背景颜色
$ w9 p% g* l8 n& Z& \1 j6 |var marqueebgcolor="#FFFFFF"
5 P* y# t: [6 I) ]6 j9 z3 [//是否能暂停 (0=no. 1=yes)?/ x, m) d: ?9 ^- P
var pauseit=1$ _1 K* w n/ ^
0 J5 o3 c1 c8 L8 u0 L! H( w//修改显示内容
' Z! L* w- ]3 q* y- S) h: Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 ]2 f5 [" {# ?
5 \0 z8 J1 f- s) p0 A( x" P+ Y0 g
" u: |) P% N+ k- k////下面不需改变////////////
7 r$ B, q, d3 U& r4 T& I: c& |# r) [. y- K
var copyspeed=marqueespeed
7 l3 j1 @& P* x( S, uvar pausespeed=(pauseit==0)? copyspeed: 0
' r( D: j" Y! E6 Ovar iedom=document.all||document.getElementById/ E2 {$ u2 a9 i) ]3 v! g
if (iedom)
( P5 J$ G( U9 _0 [ y" e/ G1 Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ X) C( [. i: K1 k% f R
var actualwidth=''( P$ y7 b4 X1 x% y5 F0 H9 K2 _
var cross_marquee, ns_marquee
W3 K2 R* M y* N7 l- \7 C* O9 b% y0 W0 h. @# U
function populate(){
+ {0 |, b2 q. O" c$ Tif (iedom){% `8 {9 q. k, ~- O8 y8 F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 Y$ T( ]. @7 Y) f2 zcross_marquee.style.left=marqueewidth+8
1 G; l6 n; H6 s1 Gcross_marquee.innerHTML=marqueecontent
2 |& I6 K; P8 sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 O% H5 \2 ^5 D! I( V' n# \2 f, @
}0 Q4 K6 W. F- Z7 i5 ~' g
else if (document.layers){
7 K, ]: j; P8 {" l" Yns_marquee=document.ns_marquee.document.ns_marquee2
) M T$ ^4 V5 P$ P; `$ ins_marquee.left=marqueewidth+8
( m7 c9 X3 |2 P, }7 ^* z3 Hns_marquee.document.write(marqueecontent)
1 s5 |+ R# ~) Zns_marquee.document.close()
7 w. b9 k' W7 _% A6 ?actualwidth=ns_marquee.document.width
; n. n% F$ i; i3 f$ V* @' {# t}+ a3 }4 Y" ?0 c/ n3 [
lefttime=setInterval("scrollmarquee()",20)
3 o ^# U3 m* A+ R}. r, \1 x2 I; W) B
window.onload=populate
, ^, S/ x5 J4 t/ _
; ?% I* S% R& zfunction scrollmarquee(){
L# U0 _0 F% l$ o- _: ~9 zif (iedom){
2 l/ |% M1 L Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): Z5 A8 q: ^- ?) R4 K# W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( H& R* C u# L. velse
2 U7 D, Q0 M% o# ~. Gcross_marquee.style.left=marqueewidth+8
/ u4 x3 Q& ` u5 N( z6 E0 u1 ^3 n m! d
}
- H0 x8 k% l4 ?; ]% Ielse if (document.layers){- ~5 g1 F! j( ~: M. @
if (ns_marquee.left>(actualwidth*(-1)+8))
: Z: K7 _ E: e# K$ |ns_marquee.left-=copyspeed
( H( {- Z2 ?8 @; u9 d: M" p/ felse+ [9 r' n' y: e, E
ns_marquee.left=marqueewidth+8 J, P) O8 c" L2 w
}5 Q0 U, A; z" h" n. N
}& g# }# N' O2 ?
- C* ~8 ]# v2 ^ I+ y9 zif (iedom||document.layers){
1 W# S, p M; ]/ E$ owith (document){, |3 e0 v' k- V7 B0 p" i) a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( t9 R; W3 Q* y+ g
if (iedom){5 S' P2 R. m6 u) u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' d9 i& e! I h/ a& x+ t$ r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( A4 T% Q* g) }- Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 D3 @( G, ^2 G
write('</div>')
7 X) N% f& \! ^3 |/ b, ~}
`7 Q6 U! q, Jelse if (document.layers){6 M: ^8 ]6 { {7 G9 n. i0 V3 v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 {! B8 g3 k+ z8 A0 Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): r6 {7 o0 U8 o" Q9 P/ V# i
write('</ilayer>')/ Z. y$ \, i& ?, t& {
}
. T' R; j7 C! G; }document.write('</td></table>')
3 o) j, h; W+ s5 q1 e( m, I}
# r' `8 N2 S9 X}$ k8 ^+ C$ E. x2 c2 h$ O: z
</script> |
|