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

|
网页之跑马灯文字特效
//修改宽度* W# I# `$ C1 e. h# A2 }
var marqueewidth=300$ b0 o& d8 `2 d0 Z. R$ h
//高度
* ?: P+ u5 `' Q+ svar marqueeheight=25
8 ]! ^) V( o' L$ Z8 ~' y" E& O//速度(1-10)
0 Z/ R# n7 c/ Hvar marqueespeed=3
2 O3 f9 t8 t$ x: Q) e//背景颜色5 i" w# O% A3 X
var marqueebgcolor="#FFFFFF"4 P0 C! x/ Q4 @2 M' @! x* m
//是否能暂停 (0=no. 1=yes)?
' w/ G' V: O9 Dvar pauseit=1. H* d3 B( P b2 I Q
" L& u2 _ y- K e* B- |: A
//修改显示内容* K- m" ^& l( X' H6 b$ n! L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' G3 K5 g3 y, ~1 J2 ^2 L
* B+ H! Y) k8 l. G+ T2 U! P4 @9 u/ n) d4 G9 y
////下面不需改变////////////
. x' l6 H+ G! J1 Y4 w4 M% H! B, ~) g2 ]
var copyspeed=marqueespeed" N. S' V$ \4 c$ T, n5 N6 |
var pausespeed=(pauseit==0)? copyspeed: 0
6 \4 u+ r! V1 u) rvar iedom=document.all||document.getElementById
+ P, v: ]* x2 w" H& `if (iedom)+ f6 V6 p3 c, |4 y( f7 o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 f: P2 [. h' p- }
var actualwidth=''
8 B8 H ]) }( [var cross_marquee, ns_marquee' i' \ [0 e# Z3 ]4 {
7 P& O2 E- u) q8 q' I. a! sfunction populate(){0 t" O$ e1 J' d; ~' g J; e6 k
if (iedom){: p) F# U0 i/ w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ p: W& X' \# G0 ccross_marquee.style.left=marqueewidth+8
k' _0 F% k# T" L/ V. R! X" icross_marquee.innerHTML=marqueecontent7 q4 \1 s7 k5 J0 H' a0 j" x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 U1 Q4 Z: `3 ~. \, y}4 Y8 |; t+ s i' N
else if (document.layers){7 P f, P5 n6 y' y6 b0 G8 U
ns_marquee=document.ns_marquee.document.ns_marquee2' h# Z3 q3 n V5 J
ns_marquee.left=marqueewidth+8) {" s s3 }% V% W
ns_marquee.document.write(marqueecontent)5 z9 L2 H: z& U8 G
ns_marquee.document.close()1 S# h% C. h/ Z3 S" _
actualwidth=ns_marquee.document.width0 y# J% E d% U& ~* G
}: \6 s5 Q0 D: [. M
lefttime=setInterval("scrollmarquee()",20)
0 p; R( @1 j" h {6 U" I6 X1 Z x2 k}
: J4 Q* G0 p0 V" F9 i \window.onload=populate6 }, M# J3 N/ ]; k; X" f
3 |( C" d. n% \; v
function scrollmarquee(){
/ H7 b+ m2 r7 x* aif (iedom){
1 q3 ^% _: j. O4 \! T- b9 W, a3 Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, Z6 G! d& V% W, e% M6 o9 h( [& xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* s7 x5 l+ }2 Belse# w. h' ^6 ]3 t8 T% M5 d
cross_marquee.style.left=marqueewidth+8
# p, _9 o% s8 g2 w
: ^0 g3 I5 I7 K) s2 h}
- L% Q+ x) K; ^7 F( Eelse if (document.layers){
! w$ ^# O2 d4 c3 ]. rif (ns_marquee.left>(actualwidth*(-1)+8))
* M6 k8 B& V- V* ^5 z# fns_marquee.left-=copyspeed
s9 T/ A5 O# I' h4 @0 k) ^9 felse
# ?! ?, \6 C3 n6 N+ l$ hns_marquee.left=marqueewidth+8
8 V: Z/ k+ X- c4 t9 M' h, N' A}) F) H. ]4 E; J! B1 t9 {
}
2 B$ ^. g1 N/ }8 _" W. I4 G; O* {( M' K
if (iedom||document.layers){
7 }& ]4 P! r; p( f' z5 S" ^2 ]4 fwith (document){3 n1 i. g; z7 l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 W( E1 ^* }6 H& n% H. A9 U
if (iedom){
5 G9 w5 |& X5 E. f- y: ?2 N0 c; u mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 o' ?5 g S% S% T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' @% b' \" x1 `8 P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 A8 Y& m$ [/ R k$ y6 Z& M. g- F: }
write('</div>')+ R* X t, e2 K0 F& M; k
}
4 g: Y- ~6 O# h, Nelse if (document.layers){
5 P2 D3 P4 ~$ U4 {& Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( I5 |% ]* l- q) j" ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 F# l3 @% Y! R
write('</ilayer>')! U9 m1 R( U4 ^ c6 Y0 d) f) c
}
n5 N) {; f. @1 B, l& J: X7 b# H1 ~. x) |document.write('</td></table>'): N( f9 q4 z" ]& h, \& w& K3 x
}, _. z7 x" L7 \3 Q
}9 q! r& z" Y# t0 m. r; C. u' E& z' N
</script> |
|