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

|
网页之跑马灯文字特效
//修改宽度 F$ d3 v3 u u0 X. l5 i6 |' m' ^
var marqueewidth=300. F# C) `1 s/ `4 T
//高度
; M$ ?" e: j3 R7 ]! h* bvar marqueeheight=25/ A- q2 J. m" N5 H% N. ?
//速度(1-10)
& k! o& T: m! K- _9 E' ovar marqueespeed=34 e d$ Y. ^( o/ _* g
//背景颜色
0 U6 ?# O6 w3 rvar marqueebgcolor="#FFFFFF"/ W/ _4 `2 E: @( U
//是否能暂停 (0=no. 1=yes)?
) ]# l/ P& G M1 Z" F4 H2 {var pauseit=1
& i5 |, R- V1 F# T
2 h5 J* l3 f' @1 t/ H//修改显示内容% r) m3 e1 ?2 q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( p/ {0 f! F7 b3 d8 U1 w2 J! l
. d! a1 ^, g. `0 V
' B7 W4 D: o7 @$ }. k
////下面不需改变////////////$ ?" A& c$ }, o) z. j9 F2 |
; H) }0 h6 h: Q* s9 ^5 T# Pvar copyspeed=marqueespeed6 q1 b: u9 J& v7 Y
var pausespeed=(pauseit==0)? copyspeed: 00 ?4 k+ T$ J; Q2 ?
var iedom=document.all||document.getElementById1 n% B3 y5 T( Q' d
if (iedom)6 `% Y! `/ g% r6 R" Z# W' ]4 Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ O) f0 x/ C0 z1 o# ?$ p
var actualwidth=''
; V3 M, s0 M4 c R- A1 `8 S. d) rvar cross_marquee, ns_marquee
& H& S' f: Y$ B$ e" A. O0 F) k; W( ?* j$ [5 t. d& }
function populate(){
8 I! c5 O2 M+ hif (iedom){
/ D6 ?( C- x* Z( J" ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 \# h" |# e/ y% d+ t% gcross_marquee.style.left=marqueewidth+8* v7 |; u H: |& k& _
cross_marquee.innerHTML=marqueecontent- @- L2 S* k: y3 n0 ^, V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 c& [2 x3 b6 s4 l, c7 h}
5 V& ^! T4 |2 A$ |5 x9 K5 U8 aelse if (document.layers){3 E; U0 |/ [' r& f& ? K0 j. i, L
ns_marquee=document.ns_marquee.document.ns_marquee2
1 t7 a0 s( }2 C4 E+ p3 K) q) sns_marquee.left=marqueewidth+8
8 O) P! f6 |4 ~9 Rns_marquee.document.write(marqueecontent)
! R( j) B7 F2 A! e2 ], jns_marquee.document.close(), N* }! b( x+ p0 A$ d
actualwidth=ns_marquee.document.width8 k e" M& j# F3 ]
}
5 r, p) ?* O" e; b. b# e$ ~lefttime=setInterval("scrollmarquee()",20)! y' l1 {- A; S- A0 C
}
3 H' b6 i6 [! v5 c3 vwindow.onload=populate
6 r# g! x% k+ N+ M
2 d, K) A# H/ k& Cfunction scrollmarquee(){! ^4 N a' B7 |6 ~/ S$ T
if (iedom){
: d# R% Y7 d! O2 c8 F4 `2 Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 Y( \" `+ o! X2 b) e
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 G0 i8 p5 C4 I
else
, x8 \9 o7 k2 O; |$ M: V) H6 gcross_marquee.style.left=marqueewidth+80 b( q$ L+ }' H; x5 g( E
9 a$ U2 n7 s4 |$ m0 j" ?$ e
}4 s( U- j( ~6 O2 b7 M
else if (document.layers){( ?. Q c' U3 B# @8 Z8 F$ E E
if (ns_marquee.left>(actualwidth*(-1)+8))
( `; E+ V# \; v6 i+ P- E) @ns_marquee.left-=copyspeed
/ ?5 n x+ ~& J" y- |! M* p! S% @else
8 u8 {0 x8 K) ^) a2 t- [ns_marquee.left=marqueewidth+8; h, z$ ]4 W/ h, Y- j& J' }$ [! h! m, h, _
}5 v! i. C2 X" s( h% _" p0 b
}
1 ~4 w% h# D* E8 Q O* {9 Z( [7 I$ |% c. ]8 H ^3 p1 d
if (iedom||document.layers){1 L8 ^# V& d9 V1 j6 O" u0 U6 T; Q
with (document){
+ X6 b1 H1 y) C! j4 Q ]* F: s0 Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 q/ |7 i8 k* X
if (iedom){
3 d8 U; p1 n& X6 ~: }$ Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 S1 n( t: t# e5 a; b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- ~, D6 h% Z* `' _, C) kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 @( b4 K/ ~3 s$ e$ F
write('</div>')
9 f5 E; e% l; e+ e" |" r f8 ~9 f; [}
& C8 K; v* {; S' h) m7 m, Felse if (document.layers){
F1 ~6 ?' [+ U- k3 l# Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ T+ s' H7 ]' S8 z+ o! ~5 s" Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% ? F! v* }; k: Fwrite('</ilayer>') F$ ]) M! v. F& n7 V- f9 {: h
}
5 Z" t3 e* Y6 k0 A: j) mdocument.write('</td></table>')+ N- C1 [- O/ E8 R: e
}& Q0 W8 p; |2 w) `6 t7 P
}6 I& ]+ ]3 J( n9 F6 p
</script> |
|