返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 e2 W( s  q  {
var marqueewidth=300$ L& f: T# G  w: Q6 u" {3 w
//高度0 _" N0 O1 o% Q  v' ^/ T; j1 ~
var marqueeheight=256 p. u" y6 a+ t9 R8 H* T$ \
//速度(1-10)
9 u/ e3 x1 z  T# s  n1 |var marqueespeed=3' s9 A1 g/ S8 {) D* R: y9 d/ r
//背景颜色# C- p' K6 N1 {* y6 p
var marqueebgcolor="#FFFFFF"3 P" t/ a  K3 f5 M9 u: r; N2 E
//是否能暂停 (0=no. 1=yes)?
( ?5 v! e& f- D0 T- D4 Dvar pauseit=1  e5 I/ @6 b/ w
. b: v7 c; h2 g; l: w/ k$ K
//修改显示内容
1 K% g; O# `- C/ n2 v9 Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* Y: E$ `3 B! T- B/ H

* i- u+ \/ z' t- L5 `  t+ Q' D- L. K2 T7 g: c6 p- E* M% t. A: f  [/ z3 N
////下面不需改变////////////! g3 e  b; c# w6 Y# z4 e3 e7 R
) {5 r) n: r( l! `; ^5 T
var copyspeed=marqueespeed1 E$ z" }7 ~+ @) ]% \3 q
var pausespeed=(pauseit==0)? copyspeed: 0
% U0 o7 Y4 s; M) ^% `8 }var iedom=document.all||document.getElementById
9 R9 n* B' X% t% F( d* sif (iedom)
/ ~2 T) ]( B+ H8 b7 Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 N6 @( h  K. p; E$ Q/ Mvar actualwidth=''
/ U9 ~3 H4 Y' K7 ]var cross_marquee, ns_marquee
) g5 F/ i' ?/ f$ @
& K" W) ^6 }) v* c/ x" T7 U0 sfunction populate(){
. X- [& g$ ~. ^3 s( G' T! J. Iif (iedom){
0 c$ p) E' h9 s" icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 ^+ _1 O- h0 q/ z8 zcross_marquee.style.left=marqueewidth+81 D( \! ~0 D1 t5 v" u7 K
cross_marquee.innerHTML=marqueecontent* A  x# `8 y6 q# e! M4 k8 Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' S! ?3 K0 W/ u6 i; h! L) k}  C3 e5 y' v! J9 L3 N
else if (document.layers){
5 j, U" M( N2 A+ jns_marquee=document.ns_marquee.document.ns_marquee2) z0 L% x) c3 z, |
ns_marquee.left=marqueewidth+89 a' i, _+ s; \' U5 ~0 @( ?
ns_marquee.document.write(marqueecontent)
& R8 `, W( H) yns_marquee.document.close()$ J2 x2 Q/ Z1 l5 u
actualwidth=ns_marquee.document.width
! y( H* O0 _" Z$ H+ e- h: K6 l}
$ B/ L/ Y: v# [# J4 W) Y& Glefttime=setInterval("scrollmarquee()",20)
: O6 w# s4 [% h8 w, T7 h& b% D}
! P' y5 O4 q2 C/ fwindow.onload=populate" a5 J( n& V# u6 K

  T' @, Z' V8 K/ f) ?, E) ffunction scrollmarquee(){# N* P) a8 i4 z- G5 A7 I" N
if (iedom){; \0 \# M1 b* {1 D. |$ [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" ^5 z- `( L$ v% P3 ?0 X4 x
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ Q. i9 N- N" X+ U/ a7 v/ W/ B
else/ W  A- B, J# e& W
cross_marquee.style.left=marqueewidth+8
  F- N; N- V5 F4 m5 T& g* Z  [" g! c* O! h- E
}$ r$ G* d; k% k4 x3 g
else if (document.layers){1 s. g+ F: |- d# w5 d* Z
if (ns_marquee.left>(actualwidth*(-1)+8))4 M/ }- S# h) L5 \- E
ns_marquee.left-=copyspeed% j2 X+ g" \2 q1 Z" e; W( E9 @
else
: j: }. w, T: v  [) z: E  |ns_marquee.left=marqueewidth+8
  J' d4 W, Q+ E  w; D6 B2 J% Z}% z5 S* c3 [& Z2 i2 V0 G8 K
}5 G4 U+ O: p9 K2 }3 Q8 G
+ g- `- {+ b/ }: M. v
if (iedom||document.layers){/ \- _; Z5 }1 o# e2 r# B' B% o
with (document){
, S- j$ m6 E7 Q5 F5 ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 i+ S2 Z* o. _" {0 j0 L# C1 }
if (iedom){+ ?, E( P& D3 e% t8 c' s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% M6 a( J8 [! d& ]
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( k5 [. y) `) Z2 y" Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- X+ U& ]4 X. D" H0 D; K( J
write('</div>')" ^/ y$ _5 u5 H- D. E. ^# B$ s9 i, E
}' b' b# @# ]; w3 S
else if (document.layers){
6 L5 M( q6 d  p6 Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- W4 D& S% l" ^+ H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 N" Q' I* f1 N' g9 f9 J' ]write('</ilayer>')
; u. X4 P7 j' K% k}
6 M! w* D1 n) Mdocument.write('</td></table>'), S3 ?( J$ d' a( J! K
}
; F. }" g) k& r2 Z}
! ]5 ~* q! T3 B' y</script>

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