返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 u, L4 Z; ], g# U( {! b3 W
var marqueewidth=300
- k8 D! ]3 ^* N. I5 m) }% c//高度
# P: y  a* x# X; C$ Mvar marqueeheight=25
: ]& T) G1 T% L$ S% I" m% ?//速度(1-10)' U: X9 I; l: U- `' K" C
var marqueespeed=3& w* _2 l: z+ y( Y; p6 f. n/ p8 i
//背景颜色
$ N5 T" F' ~$ d6 `' e2 nvar marqueebgcolor="#FFFFFF"
3 T* k) S7 Y8 \3 b//是否能暂停 (0=no. 1=yes)?
$ C3 l2 o. s4 x) R, c# d3 j# q2 s* Hvar pauseit=1
0 h* D8 O! `9 m  V9 D
9 b/ ]0 Y" Z! \//修改显示内容
$ q8 d" S; f2 Q4 P2 T& P" `' Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 i5 z% S. R/ _" {1 N3 b$ ^% n
& F) N8 @/ x* F
0 G$ \6 t' a4 p( U% \& `: K. I
////下面不需改变////////////& N3 i. \6 p! ^0 G1 z2 k; S

6 D% n8 D5 w; Q" Q. wvar copyspeed=marqueespeed
' F9 v& ~5 D& M) U  Rvar pausespeed=(pauseit==0)? copyspeed: 02 U1 s! `. Q  O+ E+ _6 t
var iedom=document.all||document.getElementById
- G1 O! g+ T0 R) I9 Gif (iedom)
  E9 r, h  p6 l2 Q2 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 |7 q$ O& @/ g! ?7 ]) F- `* M2 Q
var actualwidth=''3 E+ ?+ J; l0 n# Z$ Z! M6 r
var cross_marquee, ns_marquee
0 f) k3 {% S$ P& C* M( C$ m  C& f* Q1 J' r$ H# x) u
function populate(){( K" w+ P2 W* b% c# z) g% x# Q3 B: N
if (iedom){
$ Q1 ?) w  C2 }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& V: B; ]* B; V- J; [! k8 S2 x9 @cross_marquee.style.left=marqueewidth+8
* }0 L4 r+ Z+ f1 N  v  Y1 Bcross_marquee.innerHTML=marqueecontent
2 T: b" }7 i& f$ x  Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* \+ c# j8 k9 n& E' Q' R" v4 g* S
}6 d/ [) _7 w( |6 F5 {/ c" o) D
else if (document.layers){8 K; {' Q( V# T, o9 D* [) s: O! V
ns_marquee=document.ns_marquee.document.ns_marquee2* y2 J- [7 w2 Q) O& A  w4 U
ns_marquee.left=marqueewidth+8
7 d1 V* v+ O) y2 v1 V- nns_marquee.document.write(marqueecontent)
. P( z1 x; P3 ?9 Ans_marquee.document.close()8 m; r# A/ _. [% u1 n0 s# u
actualwidth=ns_marquee.document.width
' [# i) [* W+ R1 j- Y, f, {, F& |}
1 v' V( `/ W, F/ Z2 R1 P, Z2 alefttime=setInterval("scrollmarquee()",20)
4 E) y" ]2 ?1 H}
  G+ z9 Z. @$ r/ u# y% Dwindow.onload=populate& A$ A2 p6 j. n" W* b% D  _
9 @, _7 x1 Z; m; O. h, E: Z
function scrollmarquee(){
! L- M4 b- D9 w( K2 @% K. ~if (iedom){/ t7 w0 E2 h8 N8 v* P# u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 ?5 h# }" `/ C* n6 n0 P) t# g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 Q9 {1 W5 l+ ?) B* Qelse
3 C: e" T0 p% T! V7 `  \cross_marquee.style.left=marqueewidth+8
) p: h: _: _! }; z: n
2 a4 W. x5 O- H, O}
0 J& _/ t- \( h7 ]else if (document.layers){
1 ^: I% K; R* d" ~4 ^! ]if (ns_marquee.left>(actualwidth*(-1)+8))  ^! R. ~" q( a* k( F
ns_marquee.left-=copyspeed' S+ ]( u! U3 C+ @4 c2 E
else5 u4 V. M/ g% S% m
ns_marquee.left=marqueewidth+81 H) i& b2 t% |3 A; e
}
2 o: L% l0 u' ^}5 m3 M, v6 A2 A3 h  i1 R
4 K1 ?: L, g- a
if (iedom||document.layers){2 q4 n% P0 v$ j: W* R
with (document){/ ~4 u! q5 |' f4 o4 e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). V5 ^( Q5 ^6 B0 h0 ^; C8 [6 m
if (iedom){
6 F, B2 R, q1 S: ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 h9 z* c2 x! F& k3 ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 r5 l- I8 }; twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 M; @9 S1 P/ u2 x' awrite('</div>')) V( z" w; d/ ]& ^* F5 I
}3 v: w# v& o0 N- w  B# ]
else if (document.layers){1 x  W# x% v! H) m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  F! _5 h6 {7 z2 @7 qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 ^9 h9 w" X4 x% r- @; m' L
write('</ilayer>')) X3 d4 N3 y' i2 `& k) t/ ~
}/ V3 {+ Z" O5 j9 l6 g
document.write('</td></table>')
% A( |+ ~# m% S1 \% G- O# M}
/ R  y4 q' I) U, z& M# l}
7 P1 j$ I3 {" M& f7 D, o/ d</script>

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