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

|
网页之跑马灯文字特效
//修改宽度 V+ @; i4 z L4 F' r
var marqueewidth=300
7 a* H& {) \+ t2 Y0 G# _//高度
5 \& Z6 J: ]" ~var marqueeheight=25
( u# ?# X( W2 g2 Y# W" V//速度(1-10)
% }( h Z8 q ?: ]. ^3 p, Kvar marqueespeed=3% o/ S* @3 L# ~" N7 c$ G, {. P4 m
//背景颜色7 y p! [, G$ ]# ]( M' B0 M
var marqueebgcolor="#FFFFFF"0 s9 D; t: x1 a4 A
//是否能暂停 (0=no. 1=yes)?: t+ M9 _. R) R, k; C
var pauseit=1
. A; o) W% D% z7 I- y( n5 G: T; C0 W0 T( H& }3 ?) E
//修改显示内容 q# M9 v; p; c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% \9 t$ V* B# R: ]7 l) Y+ P- f; h( Z! r: P: t4 F* W
. Z; d7 ?. H, q
////下面不需改变////////////8 w4 i: g, _( M( F5 S
X2 m9 P- ~! u, [: E7 _
var copyspeed=marqueespeed- V p% F- T. U
var pausespeed=(pauseit==0)? copyspeed: 0
0 M2 W5 c& D& a( ?var iedom=document.all||document.getElementById
; z6 }& V* @* ~1 X( T0 r, ]if (iedom)
0 o9 b: l; G$ z' {document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 H* D6 T) \; v5 A4 n# Mvar actualwidth=''6 q5 u& D; |! a
var cross_marquee, ns_marquee1 t+ F/ G" b! T" R0 N, q& y
# |. O1 R9 F: E- M3 j3 w6 G, ?- D
function populate(){
+ [' j8 g; ?- G* sif (iedom){
- S' w! K" R; s! m- N, c+ J& S; f7 r9 dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) k' E8 J& ~3 x0 c% y8 q* D/ Q
cross_marquee.style.left=marqueewidth+8
* `. J% {, A1 Z6 R/ Z5 lcross_marquee.innerHTML=marqueecontent
0 v$ j1 A- @% G, m1 V; Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 l4 v8 f0 l- } R" e
}
4 G) O5 C6 c1 q: U5 j! B2 oelse if (document.layers){9 F1 D/ r. k% v& [* {& s, P9 a8 F( O
ns_marquee=document.ns_marquee.document.ns_marquee2
9 F' u5 `' j; f1 Ens_marquee.left=marqueewidth+8
% ?! ?8 Z" N, l; p& Uns_marquee.document.write(marqueecontent)
3 @6 z$ ~! U! E/ Ins_marquee.document.close()$ @/ ~: `& Q& ]; G: Y- j
actualwidth=ns_marquee.document.width
# f/ ^$ A$ `& I4 q7 r* h' d1 G}
7 }! i1 q( `8 Ulefttime=setInterval("scrollmarquee()",20)0 _4 p) u$ t2 R6 g$ N# w/ t
}
' B1 D& u2 f7 \5 b' [& ^- l1 i# _window.onload=populate: [$ |4 V- x) k& x
0 J$ X' l1 ]& wfunction scrollmarquee(){3 K0 D( Y# C2 `2 c. C, R8 H
if (iedom){. p3 j8 b9 x7 T" Y! X! `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ `9 p9 j( W( j0 R# i7 i1 }8 F/ b, C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 }! Q7 l7 M$ j& ^4 V: R8 G
else
8 K! u9 r9 W8 A) r* g1 ncross_marquee.style.left=marqueewidth+8: _9 \1 W8 `, g# n! p4 H% [9 z& I1 ]
" B1 w9 L. U9 Z% G}
: Y" k9 L; w' _2 ]else if (document.layers){
* V! F' X3 l/ A+ z6 kif (ns_marquee.left>(actualwidth*(-1)+8))
9 X1 {0 L: W T0 tns_marquee.left-=copyspeed m9 q3 }% x$ y% W& T- ]
else
" c7 E* n1 |- y; Cns_marquee.left=marqueewidth+8
' a5 s" p) c6 X0 c}/ d9 x; \- d, R/ [0 T2 Q. i. T5 Q' x
}8 f4 ~" ] a5 B* O* x; x3 K
" S" D, d* ]7 x, N/ b; Mif (iedom||document.layers){0 P) {' C5 v- w) T
with (document){- T" }# P6 H+ G9 {. ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- s: X$ X$ T5 h# E! @# z! Pif (iedom){9 V( ]5 L7 d- _3 j# i
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). ]% a9 N" I4 I& E0 o a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ C1 |$ g7 e2 q. v7 j" w+ Z1 t( Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! K. H! c# _4 q0 ?1 u3 n) z0 Uwrite('</div>')
, w% k1 j) w9 |3 q% S- _5 a. W}
) Z( |9 y6 W2 h, }( t$ |else if (document.layers){
; G! M# I) M5 K3 I Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 g5 s, u$ V6 O; R7 {4 B: Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. C9 x2 [* n$ p% w# [' Mwrite('</ilayer>')
) m. z, E! S3 K4 Y7 ^) e- H# t- a* S* J}3 t% n; {) l) i) R1 D3 t4 Y8 d; j
document.write('</td></table>')& \8 h& N5 O; a9 ?* d
}! N' C9 U2 T0 A
}
, }6 V8 q/ W" c5 y: N4 J( [1 m</script> |
|