返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 D  J. X# o2 U& t( p( L7 r- Qvar marqueewidth=300
; v  m+ G7 ?+ ?( n1 k//高度
0 [) O( a0 [! `2 x' o( G; E; u  evar marqueeheight=25* q) e; @+ t4 V
//速度(1-10)
% W1 }4 O2 q* E6 y0 lvar marqueespeed=3; C+ _4 Q) N( b6 C1 k( Y# H7 D3 p
//背景颜色# }$ p2 j' H) p, l. P3 P+ e
var marqueebgcolor="#FFFFFF"
! J! `9 S0 m& I- B0 S, y# p1 z! _! x//是否能暂停 (0=no. 1=yes)?: v7 n* g% G5 D5 @+ Z
var pauseit=1
* t# \6 i8 [: l3 A
4 F! q: z7 u+ ]. g* e//修改显示内容% g% X/ s* o/ W2 \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': J3 ?4 c- T/ ~, X8 R" `

' P2 x. d- d+ n% u
4 y1 v% _: U5 h& y0 Z5 A////下面不需改变////////////. U. B/ U3 R% w3 k$ k) `4 U

! b1 p# C4 \8 [5 v: e" tvar copyspeed=marqueespeed( ?6 W' V7 X( o- P, T& ~
var pausespeed=(pauseit==0)? copyspeed: 0
) ~" P. y% N1 y. Z% E" k5 Mvar iedom=document.all||document.getElementById
+ H2 ?* @1 u6 y% ^9 N* Z9 lif (iedom)
9 S0 ~+ x- o3 q+ h9 i2 X+ m0 W: @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). Y7 `5 Q+ k" n
var actualwidth=''
( f. N( A* J; I9 D. {9 [$ T( `2 Wvar cross_marquee, ns_marquee
& {. L) \) g3 W( t* ^" t' A. G7 r& y9 t. F: d7 e9 E
function populate(){
. h3 p( Y5 P, Kif (iedom){
/ O3 P& Q: Z- A7 R6 Q! y& Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. R  H* B! Q( tcross_marquee.style.left=marqueewidth+8' s, R8 X& Q# x% k
cross_marquee.innerHTML=marqueecontent/ q. m3 e$ e& @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, z2 A, S' B$ E1 w6 U5 s: N1 E- @; t
}1 D- u$ v2 t7 f
else if (document.layers){, d6 ?( v& {; A: {# H3 y
ns_marquee=document.ns_marquee.document.ns_marquee2& @2 m& x' G/ c& N, O6 Q& y2 G, y
ns_marquee.left=marqueewidth+8
' A' Y( }  L6 W  P. Uns_marquee.document.write(marqueecontent)" L1 j3 A  b! S. ]6 g
ns_marquee.document.close()! a& p, E& c3 W( X
actualwidth=ns_marquee.document.width
! [, L+ D) b9 N1 b/ j4 u}6 C4 `: j/ h& X- N
lefttime=setInterval("scrollmarquee()",20)& d2 A1 C, O" S, f& Z5 h) |
}: s& h" V1 ]: {9 q
window.onload=populate* O1 F; t8 [( E5 _) T

- K- y3 N: Y0 k+ dfunction scrollmarquee(){
+ t  H2 ^3 b" m2 i3 h4 ~, _if (iedom){! b+ u$ M' C; b3 n/ D( K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ A6 i* ]  S7 ~0 H* Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( H7 w! F( B, J5 s
else
+ D0 M1 y3 G$ h& xcross_marquee.style.left=marqueewidth+8
! C" A7 @2 T& \: u1 A- l& s5 A" B; a$ ~- v# \
}
: D7 K" i1 B: z  N& u; Yelse if (document.layers){
$ t. z8 P& Z. b6 ~% J$ C  Z8 Hif (ns_marquee.left>(actualwidth*(-1)+8))
2 y# x$ C% i% ~. f7 ^ns_marquee.left-=copyspeed& ~5 G& d: k& o' }1 Z/ @9 X
else
3 u  ?- H4 a, b  k" y' }1 `; ?ns_marquee.left=marqueewidth+8
3 ^& ]/ G  H' S' Q5 {' e6 G}4 I6 z" V* E( b+ Z5 T5 _9 [) h  `
}
0 P! y) d& j. V- k' \& a2 N7 f* L0 p% C' s& ?( y/ w
if (iedom||document.layers){
1 ~4 S6 Q0 d4 Bwith (document){0 w# p5 o) O# e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* z& T, A1 z+ w' e+ G# H4 aif (iedom){! ~/ Y9 |0 K0 _* n: k- b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" {. F3 W2 u/ F* y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ I. I/ O9 S3 ^. V. i, N* {5 j" Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( O) S3 G/ P& v8 E# @8 b" G& ^/ y
write('</div>')
$ c! n% q) O6 r* B" x/ {}  j7 D$ ], _6 f
else if (document.layers){
' l7 D  z3 m' l; n/ Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: H' Z7 }: J( ^0 ~" q* b% T  ~. Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 m9 @) h' Q7 F6 G$ i! @3 m) pwrite('</ilayer>')& g& J" W- c$ a$ b' J. X* K
}" G7 |  ~9 x9 }0 {' t
document.write('</td></table>')" x9 v# t  t4 g8 s% T) m( J
}
2 \* O9 H5 r9 a) }}
; W, A. u' G* x2 g5 k0 Z' {</script>

返回列表
【捌玖网络】已经运行: