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

|
网页之跑马灯文字特效
//修改宽度
+ L: ?- n/ O$ vvar marqueewidth=300& U2 k/ c# @6 \! {8 y% n+ E2 n
//高度$ o" l! K* c. r; G6 L
var marqueeheight=25: R" O+ x x) j0 u
//速度(1-10)6 j: o3 v# ~ m
var marqueespeed=3
0 s+ k! G. ?! D# z& a//背景颜色0 v$ N1 _7 y4 @6 z$ [; R4 v; I
var marqueebgcolor="#FFFFFF"
0 I8 w, ~* M' K: J" [8 o//是否能暂停 (0=no. 1=yes)?
1 ~* x1 Q E6 x+ f8 K. B4 zvar pauseit=1
; i. t0 l& j3 c: ?0 [4 P
! C6 p7 Z" P7 A6 k( a: q//修改显示内容5 e$ L6 A }% v0 K) q& i& b5 m9 ~* Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! t- F0 ^: \; h% R; A- V" H. u( @1 W4 H) H7 v/ W
2 P# D' [- I1 X0 k2 T& |9 A& o. c
////下面不需改变////////////6 E+ Y8 p" R+ M" h
s3 V% j. ^* {% g' X
var copyspeed=marqueespeed: m2 r6 N2 C( E T" i& a$ T
var pausespeed=(pauseit==0)? copyspeed: 0% Z( q) I0 \1 |/ b
var iedom=document.all||document.getElementById* W8 Q/ W* x# c
if (iedom), U \) C' F2 Y" K2 Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% v7 f/ T q3 E9 l; Zvar actualwidth=''
( W0 n3 ?/ A7 F; {( {var cross_marquee, ns_marquee( b8 L# V; M" D; ^
. l+ s: n9 R2 c- vfunction populate(){) g" p5 H; n, x
if (iedom){2 b' H! I4 f1 s: `8 {4 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 B' K2 H8 `. b; J! C* U# kcross_marquee.style.left=marqueewidth+8
. k; d0 D; r* T) e/ C9 w1 b; W1 Across_marquee.innerHTML=marqueecontent7 c# k( c4 Z, G! }. ~ }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( J h8 v, s7 y
}( @3 p4 j4 s. m; b5 L/ g3 B0 o
else if (document.layers){
/ X9 E( Y7 a4 g9 h* w& ]ns_marquee=document.ns_marquee.document.ns_marquee2
3 B1 O, f" c/ Tns_marquee.left=marqueewidth+8
1 w0 i: {. p$ K9 i! K2 |ns_marquee.document.write(marqueecontent)
) h @+ N$ V6 | Xns_marquee.document.close()" ^: e7 n+ z7 J) b$ B" Y3 @8 x0 A
actualwidth=ns_marquee.document.width. L9 B: P" G# |3 q4 z* i* x
}
- [! Z& D0 |% Ylefttime=setInterval("scrollmarquee()",20)
6 ^* E' H3 |0 _/ i}# L0 z9 q2 e- B6 g
window.onload=populate
! @9 d8 R2 |( ?
2 q4 R3 O0 K) A- }) H2 [ u; hfunction scrollmarquee(){
H3 n9 K$ B$ K5 b4 x/ qif (iedom){( T* L; O" f( p9 X9 o' K# F/ C6 Y2 d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 J; S5 O) U- f( z# X! E# G' k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( U1 L$ @1 g+ S& zelse
' }, V: m1 E8 F. @cross_marquee.style.left=marqueewidth+85 R2 t, S) \! G( }- U5 i" q
) b" h- v" H: Y+ M5 F0 G
}; V" ?/ `2 U6 d1 T( S
else if (document.layers){
8 Q% _, z, }) S C* oif (ns_marquee.left>(actualwidth*(-1)+8))
5 m" u: [" y; jns_marquee.left-=copyspeed4 [& j9 q! X* O: j4 b9 N) D
else( Y9 q) U5 t0 D2 j% D6 {- J
ns_marquee.left=marqueewidth+8
$ ]0 S9 L* q9 K# }1 c}
& n% g* M; c& e9 E$ t6 S: W}
4 P4 F1 s4 U5 H. E4 p
% S. G5 n. G+ ^+ V3 hif (iedom||document.layers){1 \5 S& y+ i+ p8 b- {' Z# d$ H
with (document){% w4 i5 J- t2 ]0 n& d& @2 [. D, T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 o7 [+ _9 \8 w+ o
if (iedom){! _2 X' @0 h9 d; r5 _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 n5 Z1 D" e8 w* \3 W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" A$ `+ H5 C9 X* }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 i# O7 U( W- N2 x0 i. q
write('</div>')
+ f0 a1 N- }( ?/ N% u2 C G}
/ o$ ?% i% y3 g' G+ welse if (document.layers){6 L. w) J5 j% i! h6 F1 y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 f8 }& ^: j) G4 R1 ?, D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 o6 x# A# h! ~, }& |% d
write('</ilayer>')
, T4 b+ ^/ }% R1 C}
# t) x7 q, l) P1 g0 i# adocument.write('</td></table>')4 N4 ?7 Z' S: x# V; |* @
}9 h1 G2 Q1 U9 Q& y& C) m
}
3 p3 q6 }, t. L3 c1 m. e3 j4 D& r</script> |
|