返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ I9 t. @: o3 K( O  o' \
var marqueewidth=300
! x: D0 i  d- @//高度
( [# v0 }% b7 B) D# \var marqueeheight=25
7 q$ `9 f% ]$ v+ C# x$ l5 |//速度(1-10)2 Z8 U& R: e* F3 Y9 O
var marqueespeed=3
3 [0 z/ Q0 d* [//背景颜色2 ^" {7 B" K/ H$ R
var marqueebgcolor="#FFFFFF"' A" L4 Z# V$ ?. q0 }; D
//是否能暂停 (0=no. 1=yes)?3 c9 v9 m" E8 K! e/ J/ e
var pauseit=1! e; r% E# u+ _

. @$ k  v/ M( M; f//修改显示内容
. y$ z( v$ m5 Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 j3 T: Z1 u' D2 k& c

; G1 R4 u4 s# y  f# O4 K; S0 V" C" o
9 j  S5 L2 x) c7 W3 R* k+ y) _////下面不需改变////////////2 N4 f! Y" e: p
! w/ {8 R" ~) ^. @; e; _8 `" C/ o
var copyspeed=marqueespeed
0 K% S5 N( G, u- n: t5 F! Kvar pausespeed=(pauseit==0)? copyspeed: 0' C2 I; p) o. `: v: h
var iedom=document.all||document.getElementById: S& z$ C* Q( N- y* t7 H
if (iedom)
7 `9 I1 C4 E7 ~$ w  P5 y4 k  Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# ^0 W! B5 q$ S+ [( Fvar actualwidth=''5 t, h5 i1 |# _6 p7 T7 R
var cross_marquee, ns_marquee% `" j: C" T  |' W, E
6 p, k5 A6 j  R  d
function populate(){% B+ e, l0 @; n4 j5 S
if (iedom){
$ E! M1 n$ G( Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# ^- e+ Z7 O5 O' across_marquee.style.left=marqueewidth+8
7 x" k0 e& {" vcross_marquee.innerHTML=marqueecontent: r8 s( M/ m. Z: B  P7 O5 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* ?9 H$ G, a8 ^& Q- M- q7 W}- R7 }: W- T2 }1 ]) S9 u& t
else if (document.layers){" f. k3 V2 K9 p
ns_marquee=document.ns_marquee.document.ns_marquee2
: d& W1 Y4 F: V" wns_marquee.left=marqueewidth+86 c7 t& c  v* q/ Y4 R) d+ y6 J' `
ns_marquee.document.write(marqueecontent)
) e% J6 \4 [2 p2 yns_marquee.document.close()) l! f" D& |( |& {
actualwidth=ns_marquee.document.width( o' {+ m" ~! k+ N. a+ q
}0 f: I8 q! n1 {6 {- @( `3 e1 g
lefttime=setInterval("scrollmarquee()",20)
3 a$ o4 A8 C) O1 E; [9 _8 }* W! a}
  j& v+ f  y! E7 Y  ~window.onload=populate
1 r6 C$ S5 P& y- ^8 V2 ?8 S
$ ~7 G. x0 V) Y, h7 C* m4 q; d; wfunction scrollmarquee(){
. k6 D- y$ ]/ Y$ P( I5 T6 \; Qif (iedom){
& y: Z& l4 r$ `1 y) _4 sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): S* H' c0 G; _% S3 E% k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 U" z$ E1 c% h2 o' l+ P7 }
else/ z& {7 v1 h5 H) E* U. D0 r4 Q
cross_marquee.style.left=marqueewidth+81 j7 B0 H. [6 D
) x) W" C3 h  P5 n) h7 k
}- i  `% y# @$ f" ?( w
else if (document.layers){
5 v7 s: H( c8 Rif (ns_marquee.left>(actualwidth*(-1)+8))
$ @' m4 `! [: I" R* a& Xns_marquee.left-=copyspeed
; j, T0 h: x; X6 I0 Aelse8 X) l: ?0 A1 G3 ?/ h0 ^& B, p) x
ns_marquee.left=marqueewidth+8
& ~  U4 ^% y& ~: T}
$ d4 A6 r! x# i. N, J' x+ W) V& O}' i0 v! N" @- M! w4 k) H
% j$ p9 E* B* [/ ]
if (iedom||document.layers){' |" r" g3 J* H1 G! v: k
with (document){
% E% z" k. B3 }8 `; s4 v& w' k( sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 ]+ v5 R5 |2 Y& }if (iedom){) J& E" ^: s* Q/ u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% }  \* G4 h" A1 K; `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 h2 J0 p, |% n; S2 ~3 s' uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) B9 _" C4 x8 {  qwrite('</div>')7 Q% G* ^6 H/ A
}
) K; s; W9 m, Z4 c3 `: m3 j/ ~# G- Zelse if (document.layers){+ {( _/ G9 [& w& K7 Q$ M& v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ p& ?2 j% o) m: }/ I  U! @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; v. E6 @: g5 o; P. awrite('</ilayer>'); e9 s8 N# P+ @5 v8 ]8 n8 H/ O
}+ j+ j+ j. X1 u! s+ J2 P
document.write('</td></table>')- l1 K% y+ T6 x
}, T. r7 w0 h+ a# i, g+ h
}
5 R$ l' U& x' s/ r' S</script>

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