获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度; T( G/ i, c% r8 y
var marqueewidth=300
; Z# q$ C( o0 {! t1 n# e3 T" e/ B  ]//高度/ i! \0 ~( Z# ~- T5 C
var marqueeheight=25' h) @. n# B) J$ A7 F; x+ E7 J5 @9 d
//速度(1-10). j6 u4 m5 s1 ]  B- I. C* Y
var marqueespeed=39 e. s0 n4 H! M8 t- ]. R7 p
//背景颜色
# r- J0 F) q  j6 ^' Lvar marqueebgcolor="#FFFFFF"
; ?5 {" B4 [+ F; _//是否能暂停 (0=no. 1=yes)?" h  B$ q; ?  W) O  K
var pauseit=1
9 S/ x. o- f4 o
9 |$ t3 I! U7 u+ n//修改显示内容. `$ |* {# v$ x/ }+ L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, t$ d0 V* Y% ~# m% A# ?9 ?; \+ T8 Q  m9 `
4 R. t% D9 a" K2 v. c
////下面不需改变////////////% P) D) c, u. S( y0 r

* D$ o# K4 s" j5 n+ \var copyspeed=marqueespeed# W% Y% V9 e( P. k
var pausespeed=(pauseit==0)? copyspeed: 05 p! B, t$ [8 Y0 Q
var iedom=document.all||document.getElementById  A& g3 u3 L1 r% m' B* o
if (iedom)9 {. X6 H* A, b3 ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 t# `4 {( Y  b7 f$ [3 N
var actualwidth=''1 C* Q+ y. b/ \. L
var cross_marquee, ns_marquee
+ T% ~1 H' g% z, Y6 m0 w
. N1 p  r* h4 Y$ E& o) z; cfunction populate(){
+ U" v/ m, {4 oif (iedom){: u/ _  }7 z* U: _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 O! o! _$ Q# ?9 R! [cross_marquee.style.left=marqueewidth+81 b$ D/ h9 d) r2 A( ~+ v" F9 m
cross_marquee.innerHTML=marqueecontent4 G$ e" l# d. n% M* S) y0 u- u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; }6 ~' L9 i2 U' z1 T}
2 H3 a) D, N: K( d5 nelse if (document.layers){
* G9 C6 ^+ f  B) s  dns_marquee=document.ns_marquee.document.ns_marquee2, }  V7 g; a  x: P/ e7 u
ns_marquee.left=marqueewidth+85 e* d6 z8 |7 Z3 F% ?
ns_marquee.document.write(marqueecontent)/ I+ \$ J) H. t, a
ns_marquee.document.close(). X9 P: ]4 U- I7 @2 i# ]3 h
actualwidth=ns_marquee.document.width
$ x. n: P, ?/ \  r}" H+ \, ~: }1 V0 u; p
lefttime=setInterval("scrollmarquee()",20)
" }6 X& ?0 e1 \- l}
/ V. v& ^4 c$ Dwindow.onload=populate# I) Q2 O- p" F5 c! k3 v

+ `# O, e# M0 m0 Y7 ]function scrollmarquee(){
* U6 T8 w' [( Iif (iedom){# c. G5 _% p2 Y5 `! x, v# a& B+ y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( L: C0 h9 Z& w) x- e$ V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* G/ L8 d# @. C2 _: Relse- H" N" D% n0 b0 _6 ^
cross_marquee.style.left=marqueewidth+8
/ t+ y! ]0 _) u! V0 c7 S. o0 V% B6 C
}
8 m; W% F  B/ O: Y6 h! selse if (document.layers){
7 U3 }) }. `& y- p( dif (ns_marquee.left>(actualwidth*(-1)+8))
# ?$ X0 a8 Y# ]& m/ i0 e! lns_marquee.left-=copyspeed' w# p( j" i! y  g" D2 |, `8 w8 `
else
- f% l; t% @- y7 d- Z% O$ S' zns_marquee.left=marqueewidth+8
! A7 f  c6 w$ a}
+ z6 u7 {/ H, \2 ~  I8 d4 g( t8 E}
3 _  ]. ?. K0 g
* R$ G/ O3 {1 @if (iedom||document.layers){
; V1 q0 `' c  V$ C1 `( s% q# _with (document){, @. v# _0 _/ v+ V  g* d/ c0 O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) Q! g$ _4 i/ G* ~: k1 Z% tif (iedom){$ O9 E7 X; V- z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 W( z% m* T1 X( u6 pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% o3 X) S! L+ ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 X' g* H+ f7 \
write('</div>')
0 K8 l' l1 ^, u, o# h; \  S3 k}, L# l0 T& h$ Y9 }! g  o9 x
else if (document.layers){9 f! s; W) U+ H! C- y7 b! z+ F) p- C+ r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 v4 g$ G4 C! a: n- ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# i0 o8 A6 a4 C, l: vwrite('</ilayer>')5 O* t- G5 }* P
}, k2 ?1 @5 r7 _8 p3 b$ }
document.write('</td></table>')
; R5 k9 m  w9 ^# v6 v1 B% a}
3 H" ]& p2 c! w}
9 ?' P! A  \  x3 e- g( F</script>

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