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

|
网页之跑马灯文字特效
//修改宽度' ?. b& {9 _4 C, S
var marqueewidth=300
% N$ g* y8 a- A//高度4 n% ]7 |1 `! ~) _( P- }9 d& i4 s7 q
var marqueeheight=25
4 j3 k7 t$ J- j, D5 R; k//速度(1-10)
: P% t8 P; ^* D: I' }var marqueespeed=3
' }8 D4 \& y7 I2 V) R6 ?//背景颜色 P9 S3 l$ J* e% k' t' Q
var marqueebgcolor="#FFFFFF"( D& N' l3 p" U' K
//是否能暂停 (0=no. 1=yes)?
8 X8 d/ Z$ t x& r( c pvar pauseit=1) O) G4 S/ u3 z6 a; D4 O: p
) C/ b7 @2 ?' @8 J0 f//修改显示内容" b& T! x' _7 `+ Q7 ^" W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: P' V" W) `: X0 w( S9 z/ z8 X* v0 D( Y6 _: u X: a7 Z
1 x6 n5 Q2 F; b- f! U////下面不需改变////////////% R9 c8 ]5 m4 n3 q0 ]
- W: z) h: G U( E a/ p
var copyspeed=marqueespeed0 E s9 \7 l- j8 g0 `6 L9 W+ w
var pausespeed=(pauseit==0)? copyspeed: 0) x2 ]5 X% t( g& b
var iedom=document.all||document.getElementById
9 r" O: ~) }' C8 L2 x0 k: Xif (iedom)8 ~. O) ^ A6 F. v5 @- ?6 m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), B; j* ^, |! h% |# M! P) M8 e+ r
var actualwidth=''
' B9 Z0 R; E- v$ ivar cross_marquee, ns_marquee4 }3 F9 E% C% H- n2 F
) G4 B' s5 o% d A: D7 Gfunction populate(){
9 K3 R2 g5 K7 L* v% xif (iedom){" ~. W3 M7 |) k6 e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# N, D% X( K* I6 Fcross_marquee.style.left=marqueewidth+8) L- e" N q2 q5 }; Q/ I' [% e( [
cross_marquee.innerHTML=marqueecontent9 k, |7 V' ^8 B3 a+ @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- N% _% |$ A6 K! b$ R. U}
+ t9 ]* M: E: | n( U' I1 U% helse if (document.layers){1 K! l2 i b+ `. J
ns_marquee=document.ns_marquee.document.ns_marquee2
2 B$ W, L9 D: ~4 t8 qns_marquee.left=marqueewidth+8+ ]1 g; _) `* ?/ b; i1 |
ns_marquee.document.write(marqueecontent)1 m0 \% E$ O9 k1 U
ns_marquee.document.close()8 O$ \6 C, M& R& ~; v6 }
actualwidth=ns_marquee.document.width
6 @/ o9 I( O" l# o9 \2 e0 T% f}+ f5 K4 w5 \& O, |9 R9 J
lefttime=setInterval("scrollmarquee()",20)
0 _6 i& b$ B. m, E# k}
+ T% A2 ]- _- `! gwindow.onload=populate
; k) u W& ^8 V0 P# p3 L$ f
( Y8 {% A% A1 V+ Yfunction scrollmarquee(){' F7 u, X1 s7 t6 U
if (iedom){* D" {7 I' a) Y% H9 X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! z+ F6 g+ U4 B; w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 X# v4 t% T- B8 kelse
9 m. u0 n8 F3 P9 Ccross_marquee.style.left=marqueewidth+8( K. |6 r% M' M. S
! ~2 s* _/ T* |. K/ B y
}
+ C! W% Y/ O2 R8 ~5 z( |else if (document.layers){
4 O* ^) _. r Tif (ns_marquee.left>(actualwidth*(-1)+8))' Y$ b- N% I( C8 V' r1 R
ns_marquee.left-=copyspeed
1 j: B' H/ W7 L- h6 relse/ Y! w& \ N& h
ns_marquee.left=marqueewidth+8# x. |; t/ n' L
}1 W/ T. n/ [/ I, N! B7 G
}
5 P7 y h! b2 w4 l
4 Y1 M s- J; V- o A6 t5 mif (iedom||document.layers){
+ S0 D; f; V3 N# v, uwith (document){
7 C- g2 x0 U% {3 r, O1 hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 ?( {( f; o" B" J! ]( h8 t% [if (iedom){
, x! O6 ? q+ c+ S: ]& wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% r5 t( `1 |- c Q: b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& L: H" b; E# M; Y3 t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! {1 X; I6 z n3 jwrite('</div>')8 \+ K3 u1 O+ U* U/ ?+ j- ]
}% Q9 O" T' {0 O$ t" |6 g
else if (document.layers){
/ a8 ^/ W1 P3 ~# u% t3 awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, k4 t3 V, x% bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% v/ |4 i5 f5 ^! A. S
write('</ilayer>')
. \5 L. s( F+ P9 ^$ B) D}. P3 p5 `3 l# ~# u
document.write('</td></table>')
* f& ?: \0 o- Q. v! L5 I}
, H& O/ i1 F2 e. |. E}( ^) e6 V) {( E4 t3 X
</script> |
|