返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 Z" V7 w* @" D* c  u8 `
var marqueewidth=300
0 ~3 B6 t, }! O, u1 J//高度
7 i! Q  C0 W% K+ G3 q$ nvar marqueeheight=25/ r" a3 v; F9 s4 K' f" ^* b
//速度(1-10)
- Z/ E3 o9 L6 Y- |var marqueespeed=3$ ?. Y* w) w3 k; O6 }3 c: U& z
//背景颜色
  u/ z: b: p( d/ @1 K6 avar marqueebgcolor="#FFFFFF"
5 J" A0 I5 D+ u: d//是否能暂停 (0=no. 1=yes)?
" M; f0 F  {2 e1 Lvar pauseit=1
, K1 p% c$ N3 H4 N2 J) c
+ `, X/ {* q  q( A//修改显示内容4 Q* Z) K/ e9 y! x- [: P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; [( h  O1 }  s+ v. @! w

. i: l% ?1 }& V6 M* R1 Y& c  e( b  a7 d4 {9 t5 Y( A- A# k6 Y! |# t
////下面不需改变////////////6 |4 N; r7 M  x  \, w4 C

2 ~$ n5 {/ I' O; |3 C; w) @var copyspeed=marqueespeed! V, `2 b+ ?( i2 t. i# P
var pausespeed=(pauseit==0)? copyspeed: 0
% l6 U8 S, s8 a  w- Z; k8 ~var iedom=document.all||document.getElementById. }2 u3 E- x# ?/ E2 w
if (iedom)
7 c/ ]6 G, C6 {; p; q& A' }' @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 l0 W* e2 @  B  ovar actualwidth=''
; K+ v- k3 m0 p  h- ?6 Y0 Tvar cross_marquee, ns_marquee
, i, L4 k' Y0 c$ w, P2 D
( Z1 q5 L# |" n1 y" G; wfunction populate(){
' Y( Q* u3 \3 F' s* [0 kif (iedom){6 F+ S& s/ o/ f  X. p. q' r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ k3 V7 _7 o/ a8 A/ {  ~" R+ vcross_marquee.style.left=marqueewidth+8- U& ]4 v5 T1 h; l8 X! E
cross_marquee.innerHTML=marqueecontent9 p* R6 c" f% H, ^% r8 S
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( c8 F% a( E4 Y$ P! A% d! g' [3 J}
6 X- p( u% y3 b0 n2 x' \3 R/ ?: L: Telse if (document.layers){
  d/ |/ w) E, L; s  S7 W0 j& bns_marquee=document.ns_marquee.document.ns_marquee2
1 c' w- K" H; W) E8 {' h7 ^: y( Mns_marquee.left=marqueewidth+8
1 {& o- h4 m, ]- U( \ns_marquee.document.write(marqueecontent)1 y4 h- C/ a: W
ns_marquee.document.close()
" q0 Q1 p( d$ m5 ^; C7 {! Hactualwidth=ns_marquee.document.width
% v+ G1 ~8 x' ^}
- Z/ S0 K8 L7 M6 ylefttime=setInterval("scrollmarquee()",20)3 o, D; u  W/ o! g3 ], N% c
}
! D* \( V0 n2 @7 H: _window.onload=populate
0 g" a" c+ C, Z* ~5 q5 J, }
4 \, A9 h( R/ D; A! _function scrollmarquee(){; F& [5 e( Y3 E0 k, z3 @1 A
if (iedom){
7 I2 T+ h# j" _; k6 u( q7 _1 bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' b2 f4 S* v& r+ z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ M7 v2 `. n, R9 L7 K, Z! w9 T
else
0 y. b9 q( t' Wcross_marquee.style.left=marqueewidth+8/ i& D! U' E! }7 ~% s  [

4 m1 e3 G+ G1 |2 f- N3 O# u3 l}
: m* A/ e/ p" _$ O: relse if (document.layers){
* J) w' N* b2 q- N- R8 ~if (ns_marquee.left>(actualwidth*(-1)+8))
1 D, b$ i4 u# @) Bns_marquee.left-=copyspeed
. T: g! Q6 O+ |2 w8 g) v8 xelse+ ^' O4 x; V2 i
ns_marquee.left=marqueewidth+8" G0 W! z8 W9 n$ U+ M1 \) C. v
}
  J, _$ L) Y0 N, y* H, ~}" b% T5 `2 X: `7 ?# z3 D) \
& c; B, ?0 S6 Z: Y) E: p" ]
if (iedom||document.layers){  ]: {0 Q, M, z8 E+ h
with (document){
% k, Q3 M" O7 ~- p1 u9 R4 Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& R3 y: h. D6 q4 i9 q$ A8 j
if (iedom){
) K  Y6 v% J4 g4 ?! R5 _5 nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ G% q5 w/ b% o6 t& @; ?9 xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ ?$ x' Q* O7 N6 r+ Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' [9 k, m1 t" Q: |, M; s6 R
write('</div>')
4 I& Y# I* X1 |* i5 U! z8 p}% l) c/ P& x0 T  U% X3 s! m: g# J" U
else if (document.layers){
. p  L2 g! |1 c0 ?7 s. \2 k! Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 e- m0 N4 M4 Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ A5 Z6 v$ ]" J7 I4 }+ Iwrite('</ilayer>')
- `* g: _4 Z5 p1 e8 A5 i( q  ]}" ~( x, M2 I- w; u
document.write('</td></table>')
* B, U( \4 ?. e, z}) t9 ]2 w. ~; }  p
}, M1 u  y# [, o* U' W3 V
</script>

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