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

|
网页之跑马灯文字特效
//修改宽度/ B& v$ j! @9 f! ~- I
var marqueewidth=300. \: f2 J0 c' ]+ D ^# \2 l% O
//高度
9 ?& Z5 u( F: l' svar marqueeheight=25
9 z) Z6 E4 d% m7 O0 A& o//速度(1-10)6 j# j' f* \5 z
var marqueespeed=3
, I4 F! S' |1 t( d4 v//背景颜色9 ?! e; u1 E2 l! W- u6 c* y3 C2 {
var marqueebgcolor="#FFFFFF"
! G5 s3 M: V; E4 @1 n: l6 X//是否能暂停 (0=no. 1=yes)?
& P$ x4 Z- s" S8 D, w2 Jvar pauseit=1$ v: Q: u0 l8 I2 I
0 F- H9 a" O. D! z$ z4 m% G& H//修改显示内容; \) z8 s1 Y4 \: `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
j* [+ _; q' K$ p w: s% _' g# p
$ J/ h# n4 s9 W) y; g2 k2 e////下面不需改变////////////
# c* w, i* s ~! Q# G+ v- v" l
; R) t: S" k9 ]' t' [) e. i; ~2 bvar copyspeed=marqueespeed
+ Y, I" p8 s& svar pausespeed=(pauseit==0)? copyspeed: 02 `6 \8 E; l0 i9 r/ {" P$ y; T; j/ q
var iedom=document.all||document.getElementById; y' E5 n8 S/ X: I @/ }
if (iedom)+ Z5 F, J+ K+ P/ Q7 `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 Q7 g& {6 w& }+ W1 p+ y/ n' o5 q i( avar actualwidth=''/ U( k# w9 \3 M: h p
var cross_marquee, ns_marquee& l6 g6 t+ v3 r ~: z! v6 C
! Y. @# l7 U0 _$ Y9 ~8 y) j* afunction populate(){" m+ L \ I4 T$ x' a3 }$ ]' d
if (iedom){3 u1 T6 p# x( b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% X: r" j9 M* P% H. |/ T/ |2 i' d
cross_marquee.style.left=marqueewidth+8* P1 ~. {2 _. c, }* m
cross_marquee.innerHTML=marqueecontent( G; ?+ X$ b0 e5 D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 _. o6 `/ `7 O! j
}
, p7 P; Y; Z& d; n7 z- |! ?else if (document.layers){0 f9 p) N2 @+ A9 v
ns_marquee=document.ns_marquee.document.ns_marquee2
# ?4 J# `% z4 cns_marquee.left=marqueewidth+85 x; V& C) l Z) K7 I$ P5 n l0 ^
ns_marquee.document.write(marqueecontent)- a7 E! A) T6 ]% H; J9 u
ns_marquee.document.close()6 H# I6 P3 K4 }* B( N
actualwidth=ns_marquee.document.width
3 d+ K" p3 b3 h}+ y: j3 i* F" K! ~
lefttime=setInterval("scrollmarquee()",20)! V& Z9 K+ c |- M5 [7 b" I
}# w" ]. a! k- I ?. g% u
window.onload=populate
) W7 a& q: f4 _+ p
+ w7 Z4 _5 `' A, Z. bfunction scrollmarquee(){
( T3 H' R3 k) T& `3 X, u+ G6 {if (iedom){
9 X: s" w; O9 o- }& Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# }, D3 K! o3 X' [! R" Z0 Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; O5 C" N9 ~! L* r
else
& ]8 [( V3 U6 v- D* C8 f4 S4 ecross_marquee.style.left=marqueewidth+8
. }+ q( k$ w1 }$ q9 G- j/ q6 ], F, p) g, N" p4 y4 X
}$ j( O9 j1 x* p+ V
else if (document.layers){+ v2 j" E7 F E! _1 C, o
if (ns_marquee.left>(actualwidth*(-1)+8))
' I! d P' @6 J- o* S8 hns_marquee.left-=copyspeed
, E8 `$ [6 U. E1 {% uelse" f7 a/ G4 e3 E" I/ z, h5 x
ns_marquee.left=marqueewidth+88 `) t- w( Z3 L: y/ @. S4 g
}" x: C- `, J" h0 d
}2 P+ t/ E* M3 O8 I5 t: j& F
# ^+ w3 X" U# o0 m. x3 g8 C' Pif (iedom||document.layers){
7 w3 `" R3 M/ ]with (document){* p7 q# O! h2 \4 D1 Q6 `! v, C1 G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. _3 e: g8 _1 c, i `if (iedom){, Y+ d/ M; U& n! r+ x) o+ {6 w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): p7 \9 {3 b5 z* x5 _" B+ [" M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; @' u$ @" h3 t {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 N0 y9 V- d; h- D9 E2 \. @
write('</div>')
% n9 e! l' l* O7 K, Y! `4 Q: B: j3 i}
: ?2 K' z1 B0 S- r, kelse if (document.layers){! O P0 F$ g) h, B+ u; ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 u$ e6 ?+ \( x6 t2 M. a& Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& {' n" r* F. {6 _, g ?7 b1 K
write('</ilayer>')4 @7 W: d% Y5 a+ V( J
}
- N& a( H5 T% ]" T6 ~9 Hdocument.write('</td></table>')
; b7 G% Q# t% |! n9 q: r}
( t' c Q) t7 Y$ ?}. o) I$ u' r8 N2 d! F3 `* U) d
</script> |
|