返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 c1 @5 [0 J/ _* H) I
var marqueewidth=300; P7 }) r  i1 a! I7 p
//高度
- ]* @1 \5 b4 qvar marqueeheight=254 X+ `6 U$ J* }' [4 e
//速度(1-10)# ]5 D) S, U& C* N
var marqueespeed=3/ Q- m" [4 J$ k) g) Z; ~
//背景颜色
. Q- |1 i6 w3 G. _4 Ovar marqueebgcolor="#FFFFFF"
5 M/ z& ?; F) }$ U//是否能暂停 (0=no. 1=yes)?
  ~5 ~) s, K8 m& l" M' kvar pauseit=1
2 {: U& E" q/ V3 `
; c" _/ _' z0 U2 t  N//修改显示内容* o8 @, a2 D. {$ M2 @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 P4 N( A; h- C3 j9 k0 y. t2 X

1 L" M* E( r# h1 V9 V8 ?. e
( {* u" p  z0 Z# C& q( r: l- f////下面不需改变////////////7 {8 l. h0 [2 J
& Q% b$ B( c0 g* Y, z
var copyspeed=marqueespeed5 v: R/ q; m4 t2 H0 d/ c' z5 X; l
var pausespeed=(pauseit==0)? copyspeed: 0
6 v4 D  F% u0 Y% H9 t2 Nvar iedom=document.all||document.getElementById
7 z' D! j4 J( q1 b6 y5 y. u" rif (iedom)
5 g' j9 m, n- ^' g2 kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ J0 j0 e. W* i) S1 L3 q  o- hvar actualwidth=''
$ d) E; P4 x- v. n) n( yvar cross_marquee, ns_marquee# J6 r6 {' O4 J. u

5 x/ C% L  B" o) E9 O: T& V3 h3 Ufunction populate(){  }; I/ k: a# }5 D4 q2 r
if (iedom){+ y& o5 R& v/ k+ r  y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 u8 ~9 v5 \- g5 _$ d) \# Across_marquee.style.left=marqueewidth+8% Q' L' s( ^4 l$ Z
cross_marquee.innerHTML=marqueecontent
( o: ^0 o! B& R( t* x5 iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ S! z+ V7 g+ F! D3 H! z+ w
}
; g1 s7 G9 B) q+ v  t  s( Delse if (document.layers){
! \& {) p2 G5 S4 j% Jns_marquee=document.ns_marquee.document.ns_marquee2
) f, g: Q. o8 p# i- d3 bns_marquee.left=marqueewidth+8* i$ l# J! p: M, P; I
ns_marquee.document.write(marqueecontent)
: L9 _5 V3 ]0 o5 e  K" uns_marquee.document.close()
& E! z( U! ]# j$ i4 G8 `  F& dactualwidth=ns_marquee.document.width
8 \9 I5 H5 v: x) T- ]}; [+ }; a/ U3 ]5 [" T
lefttime=setInterval("scrollmarquee()",20)% l0 n$ N$ p- g5 Z7 }* b* b
}
4 O3 q- `" B0 g0 u+ U+ uwindow.onload=populate
6 U, X! N5 H. t1 K: d' s$ k
% |3 E) Y: S+ o3 `0 F0 y3 [. Mfunction scrollmarquee(){
! n: p" U" _5 c1 j- Tif (iedom){
$ F; M& H4 c  [. Q( fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 {3 G2 D: j9 i2 Y9 B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 R/ B7 X% B7 ~3 B( h0 E
else
, E6 v; Y( H' a2 Z9 D  T  Qcross_marquee.style.left=marqueewidth+8  O3 N$ e9 u5 l( e/ ?, R
1 q3 ^; ^- c* |2 F  v) @
}
! Z9 i: @' P6 B1 E( @else if (document.layers){) G) t  D; a1 r
if (ns_marquee.left>(actualwidth*(-1)+8))  W! Z0 r9 q: q; Y$ E  N. i
ns_marquee.left-=copyspeed) U9 P2 i: u" ]4 i) {7 U- F3 n) z
else
6 u+ @+ `7 U, U- U& G  qns_marquee.left=marqueewidth+8
7 x4 ~* h$ W5 T, u}$ h7 L+ M( W7 d  [5 Z$ [
}
$ J8 z9 g# q! D) D
6 n6 _7 O/ v* f, w3 Bif (iedom||document.layers){
$ U/ Y2 g- Q( q  rwith (document){2 F; n4 V) o% C; r% m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): r& v, H/ P6 {
if (iedom){
8 h+ C/ ]  O; \5 r$ ?8 W0 d) D8 Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; W% K5 c8 R, [% a3 pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 z5 }* l9 Z: r' E: b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ y; w- a0 k, e7 @1 N# }- uwrite('</div>')
2 K. ]1 p, e1 B}
4 h8 Z5 ]) g" Uelse if (document.layers){
8 d3 ~3 C" r3 Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ o3 }) J' x( N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ }; n+ ~. x# c  b# l9 O' z7 F
write('</ilayer>')( j2 [+ q: W2 |3 ]# P
}# w! i4 @1 N, i' Y
document.write('</td></table>')
  B  p5 p1 M7 I+ O0 H}  {) k5 i) g) C2 y- E. S0 R
}
5 ~+ E; F7 e$ a! [</script>

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