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

|
网页之跑马灯文字特效
//修改宽度4 ~7 c* U4 T8 c
var marqueewidth=300
7 R- ~4 P8 u- K9 o; R//高度3 s, V5 a5 u' e
var marqueeheight=25
' y* p( m9 J9 q) {//速度(1-10)- h- K' D$ R5 P
var marqueespeed=3: Q2 m4 X" _+ ^& k0 ?$ h
//背景颜色/ ~, S; c4 O# _. J
var marqueebgcolor="#FFFFFF"
! I: K7 T" W' ?; H8 i% f1 A; Y//是否能暂停 (0=no. 1=yes)?
# [. M# i" t; uvar pauseit=1, `) b0 k4 j1 J$ g7 l f( m
9 i+ i6 p, L4 d v( u//修改显示内容
, M w( a: G! S: ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; [& r5 u' a* J" a/ h7 _0 B$ m1 A/ p4 Q. x
9 L7 r& J; {6 \/ t+ Z0 Z1 X f: b% E: z
////下面不需改变////////////
; [/ R/ c, J$ I8 v& G
) b* m% x: ~/ A% vvar copyspeed=marqueespeed
, M8 [+ `- I. U& F, I5 Kvar pausespeed=(pauseit==0)? copyspeed: 0
7 Z7 ] A7 s: m/ M9 E% Dvar iedom=document.all||document.getElementById. i" k4 n% n& O4 a0 x5 o1 r
if (iedom)7 l# A G r; T1 a: v6 @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- Q' g4 ?; j: D3 k' | tvar actualwidth=''2 `! s1 z& v; H, N3 u( q
var cross_marquee, ns_marquee t& n9 F: `; N
6 Y/ U3 ?& N* i# m" Q" _function populate(){
& Y+ Q/ d+ N1 P9 y8 t$ p. Nif (iedom){
* _8 X; f& q* j' O1 d$ Q; E1 u5 W! a) Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 Y7 K. z3 \) w- c, `. gcross_marquee.style.left=marqueewidth+8+ A0 A) l/ z$ E) S
cross_marquee.innerHTML=marqueecontent
/ T, N; v! p' d4 j% Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 Z7 M2 ^" P- W$ C+ F& w
}, k0 p3 {# ~7 b: \5 {; } g7 ^
else if (document.layers){1 [' h& I4 `* D
ns_marquee=document.ns_marquee.document.ns_marquee2
, F- |7 V5 w% I3 S2 m; L2 [ns_marquee.left=marqueewidth+8
6 a$ b b: M4 Cns_marquee.document.write(marqueecontent)/ Z/ v9 P+ f" N! k, Y# m3 E
ns_marquee.document.close()7 H. M. m* W: v$ ~# s& h: u
actualwidth=ns_marquee.document.width5 m! B! x$ K) x4 Y+ i3 c
}' V9 y( O' {6 ?* U5 ?
lefttime=setInterval("scrollmarquee()",20)1 D, ?) n8 X% A5 v' q
}
/ X4 ~, E4 K$ z( qwindow.onload=populate4 C7 Y: W8 ^" M# {: o, ?! T
( c( `9 R& V! @+ p6 G
function scrollmarquee(){. ?' Q) w8 H. p
if (iedom){+ }# c% D" c) e& [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 ~( k! D* q. Q. u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' N3 L& K& t( S: W
else6 b2 F( o( s1 V3 v: H+ [0 X
cross_marquee.style.left=marqueewidth+8
8 b6 i& X3 c& `3 O- S* }$ z3 E8 G1 |
}2 q3 q! R' U' l8 x
else if (document.layers){! e+ j" e4 v. x3 [! A& Q: H
if (ns_marquee.left>(actualwidth*(-1)+8))! G6 q6 ^% j( J8 P/ N( y2 {# `: |
ns_marquee.left-=copyspeed
8 ]# G; m( T9 t! z# H$ [else- M# {! P6 R+ }9 U
ns_marquee.left=marqueewidth+89 t% I7 q8 ?" q4 e# Z6 t2 v+ H! [
}" x# i1 S1 i5 M" W
}$ L5 K1 a7 @" P# Y# a2 o
8 |, d* r9 i/ B# ~: o5 g7 gif (iedom||document.layers){; C& ~* h: |/ z7 {" f* g# |
with (document){7 L) C8 e/ }9 u5 H1 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* c& g x; x; U+ p6 Z# iif (iedom){4 g( J8 @% {7 `7 v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 V) s0 n2 v7 ~0 X+ ~' H/ q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). Q" N" c) V5 L4 N, i+ g
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) l- ?' a# a2 r7 }/ I- ~" D0 iwrite('</div>')2 @0 M: `) }+ J- R" d0 _: J0 ~
}' `, X; [/ m4 j& @6 i; g9 T2 o+ D
else if (document.layers){; b- ]" M7 Y6 R. O5 L3 ?3 t, g. X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') S$ t- h1 R4 L* U- a& M3 ^% g# l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 r4 c. G9 X+ s4 Z5 h6 t+ lwrite('</ilayer>')
: Z' x3 [; U) X+ ^}1 j4 C# j! L8 @6 C
document.write('</td></table>')
w! g; V/ [, k3 _}
$ ]; g2 N( K: i1 ]}* }3 Y l: S+ ^/ d: |3 X
</script> |
|