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

|
网页之跑马灯文字特效
//修改宽度
7 N' \% D- ~# [ {) R+ |var marqueewidth=300
2 `) O+ g& _+ z4 c//高度0 |/ C# a+ s7 ~; H+ S1 P
var marqueeheight=25
8 h& `" V9 T2 Q5 x! k/ D//速度(1-10)5 J2 R/ o" K7 N( G. ?
var marqueespeed=3
6 ~+ z* u$ P6 b o8 W1 Q, f4 c( z//背景颜色
9 y( m. J6 ^+ X! zvar marqueebgcolor="#FFFFFF"7 k6 w. i, u! y5 Q( x6 g
//是否能暂停 (0=no. 1=yes)?2 x" [1 X! q* ^: s+ K
var pauseit=1
- B! L' B' p. @* M( a% M( Q. c6 {' @
//修改显示内容6 ?4 f0 Y! d/ U7 n4 p0 H; @1 w. ~. S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ s* ]7 ?% J2 \6 ^, _ U; g: B& j# z5 v% T8 Y$ S$ i
. a5 {, ]# d; s& P$ B////下面不需改变////////////3 C$ k z' b3 q: C8 y
, g- }8 g$ k! K
var copyspeed=marqueespeed7 S7 L" z7 m8 f* Z
var pausespeed=(pauseit==0)? copyspeed: 0
; n. B0 K& d- H x& _- ovar iedom=document.all||document.getElementById9 H4 } I, k6 y* r) d
if (iedom)! w, F4 f5 J9 O% s* Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% D" V ?5 h, l6 w& `var actualwidth=''
" l; G+ @( H6 ~+ R- D, i g* F5 Yvar cross_marquee, ns_marquee
( b( k+ K* a1 X. {5 }6 z3 I9 J& U; [8 |7 I& R' y* }$ |
function populate(){" U* M# Y2 T+ |- [' x* m! N7 x. [0 ~+ Z
if (iedom){, Y3 q. G3 Z8 ~) Q, N" |' E7 b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ A+ ?, { E7 Mcross_marquee.style.left=marqueewidth+8
/ W8 Y* M2 c& m/ @3 ncross_marquee.innerHTML=marqueecontent
. o6 W/ l9 q3 L7 Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 [+ L$ {( n2 f3 I3 ^ ?$ \}
- _. \, W0 S/ N2 H( i+ m" g: P1 eelse if (document.layers){8 N* @- Y" T6 G& N
ns_marquee=document.ns_marquee.document.ns_marquee2
0 @1 y, ^' e( _! E8 q ^ns_marquee.left=marqueewidth+8: p7 B( K5 d4 M& z0 s- |
ns_marquee.document.write(marqueecontent)7 Q" w0 h( y8 n2 d5 [
ns_marquee.document.close()' A0 K G% Q$ i O- o# }1 ^
actualwidth=ns_marquee.document.width. T* C! z- k. |; H0 l
}" R8 N# y: K% Y. z
lefttime=setInterval("scrollmarquee()",20)
( t( Y, c: ^4 m% t/ L ^; H}
+ X5 s+ T* Z! v- V gwindow.onload=populate
3 h' X5 Y. d6 @ [/ d7 h# d
+ o$ B5 Y2 J1 |- j) k' Ffunction scrollmarquee(){0 h3 m Z: y1 y2 v9 V' M
if (iedom){
; o% b; ? b) Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 G$ n# _: W- D: }- x6 ^7 }, Scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ U L+ R# N6 |0 {8 ?else
) l/ E' m! M8 x( m* c6 N& Hcross_marquee.style.left=marqueewidth+82 g H j- t6 R. u, Y
# v; m$ |2 w! t! o) x- u}* Y& b5 p5 W- X' Q6 P' a- ^
else if (document.layers){! S; S* B" d7 ^) T; I7 X5 ?0 u3 l) s
if (ns_marquee.left>(actualwidth*(-1)+8))& Z# X4 ` F9 v3 z2 H
ns_marquee.left-=copyspeed% P7 l/ H' d9 R# b5 t% Q( S$ z& Q
else
& e6 b5 p7 x" D) \. U: H Hns_marquee.left=marqueewidth+88 {2 x# Q. l' S& c8 B
}
8 n7 W* T& U. @9 t D}
+ V4 D! u! }$ r1 W$ ?7 ]: P3 S# E2 r
if (iedom||document.layers){
- p7 m& Z+ S/ }7 ~with (document){0 U1 Q' ~9 } ^% T" J n: w1 ]6 B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ M5 i2 g" Z* f7 c
if (iedom){
3 w g0 j' E5 ]3 l" g) t6 l$ Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- c0 z/ k u& N, w Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& |& t; ^/ `" P: f. g- c2 Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- A0 _0 b. }9 }* M9 T; ~
write('</div>')
4 ^% J% _- X4 _. n+ N! x) D}9 i0 g2 E% T% G) O Y
else if (document.layers){
9 S! |. I/ a; f" J) Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& w/ b5 z6 Q2 k D) U: F6 a- rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% G4 [, G# o+ K; Z9 E; y# ]
write('</ilayer>')# E! B4 g8 l2 }7 c
}: n0 h; F; l& i5 ^
document.write('</td></table>')% k- [$ @8 _+ ]1 f5 y
}
" A& Y! _& x, n" P. s! p" K" g' B0 }6 a}) }; D3 }0 i4 F! R, E
</script> |
|