返回列表 发帖

网页之跑马灯文字特效

//修改宽度  K: W: }1 ^0 @: ^# e2 c
var marqueewidth=300" |- _. q4 m1 s$ Y
//高度
5 W5 E) P0 }% Cvar marqueeheight=253 U# Z, b0 @5 b0 ^
//速度(1-10)
3 E0 F, t* g  qvar marqueespeed=3/ m5 J4 q: B, a2 S- l
//背景颜色
$ B$ W/ A, d" C9 E/ N7 Y! ]  Tvar marqueebgcolor="#FFFFFF"/ p6 g1 D3 J- p) @% @2 X
//是否能暂停 (0=no. 1=yes)?
  l8 Y; x: k9 {1 Pvar pauseit=19 W" s  @% z& G1 {! O

  v3 d, w: C5 C% \0 |/ g# q//修改显示内容
+ ], A% k4 l* q  o% \var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 X3 `2 ]# B  Q6 x2 H* a* l
8 r3 R+ Y: j' T; ^, K: o

7 ]: L( F. D. @- S; s, r////下面不需改变////////////
8 D) M4 ]3 |) |/ ?
% E& A' E% H" w2 L! C; Lvar copyspeed=marqueespeed4 F$ F8 |/ E) N
var pausespeed=(pauseit==0)? copyspeed: 0) j( x8 G/ j" U. M1 `$ p
var iedom=document.all||document.getElementById4 \* B! {" [+ F+ ]1 F  }
if (iedom)" u, I! u& E2 p. T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 H' ^6 b2 t) t( Gvar actualwidth=''0 Q  F. E/ |; i1 g9 Z, M# ]2 k% d
var cross_marquee, ns_marquee8 |6 V4 ^0 B3 R- j6 c7 a1 P2 p* L

; E5 ~+ c" v2 p# afunction populate(){
# M+ ], X; f! g8 `( T( t; S% j. n  D3 Fif (iedom){1 f. W1 W4 \# D6 u( k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' S% Q/ ?# s0 ]9 h) h; dcross_marquee.style.left=marqueewidth+88 t# m) D" g" F  Q
cross_marquee.innerHTML=marqueecontent
0 i3 P/ y: `; k( b# tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  _: K1 D/ x* C5 `. X7 ?
}
4 @2 Y$ \5 x. M9 P+ ?* m! r; m! A, Kelse if (document.layers){+ ~; p$ A$ {1 \0 ]7 K' j" }
ns_marquee=document.ns_marquee.document.ns_marquee23 _0 p5 V9 z7 }0 z5 v
ns_marquee.left=marqueewidth+87 @$ m7 f! _, U" U6 h: {/ R2 n- V
ns_marquee.document.write(marqueecontent)
3 _$ g* {+ k: ans_marquee.document.close()
3 x5 _4 i* v( g6 h: s1 ^" gactualwidth=ns_marquee.document.width9 [$ k+ E; i! W0 I7 _
}
# R  U9 D( j) J& q- {+ h6 Q" Klefttime=setInterval("scrollmarquee()",20)9 D: ?4 j% u0 q! T: w. q, S; \
}/ z* O, g* O9 Z
window.onload=populate
9 Y5 E) |* M" r2 C
0 F) e$ H1 }$ p! G& Z3 Efunction scrollmarquee(){( ~7 G/ u& `4 V
if (iedom){7 V0 e3 y/ d6 |* z1 w- N( k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ d& d# P0 G) H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' s, @; S6 N8 Qelse$ m5 a4 L, \8 ]3 g
cross_marquee.style.left=marqueewidth+8
" C, ?2 t, T. H) X7 n
, C1 d# u! _5 H4 I3 L# w}
* m5 H' w) H; _! S/ g4 N" ~else if (document.layers){/ |" Z' C7 z3 G# I# T
if (ns_marquee.left>(actualwidth*(-1)+8))
, Q# @3 n' j) k0 [# rns_marquee.left-=copyspeed
. [8 o7 c; w: Z* Kelse
. K, {4 y1 M/ ^# Uns_marquee.left=marqueewidth+8
% m5 g# p% m5 X7 x! l}
/ y5 H! {6 Q! S$ w: o& ?! K# g* a2 `* P}' {3 p1 `& k8 _8 M% N  z" Z

- k4 h1 Y% ^0 B6 {, o+ Kif (iedom||document.layers){" t2 q; ^! ~7 z# e6 i, j' @9 J$ w
with (document){
, e# s, M. z% u9 d7 V  Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). p3 b6 t/ z! v7 l
if (iedom){# D& }, ]* C) Z  l: w6 b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 o& d' g' o: p# Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, ^8 A1 J! m6 @9 d2 nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), u( p" R, q3 R# I+ y
write('</div>')( B* D; T8 l$ V/ J" O! p! d- c
}3 n8 o9 I5 X2 V
else if (document.layers){! U" v- L; j* r4 A8 |. G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! D1 |& {1 o3 \- P3 [5 l- ?+ Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& l- g7 u8 \7 g) M% W0 j  g
write('</ilayer>')
0 j8 }2 O8 l1 v$ n}9 Z1 J# s! v0 N% X; [4 `" s+ ]
document.write('</td></table>')
: l2 m9 q$ d# _9 F( k1 j}
" v$ R( T8 v: P+ J+ B& u# \}' F+ ~6 T2 n' @" m
</script>

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