返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( E" b2 Y0 Z+ K/ _2 E7 M# |4 Nvar marqueewidth=300& ?8 g) l) K" |& `; L5 ]0 f
//高度
; O" O7 ~' }) h' a+ u$ V' v! dvar marqueeheight=253 H! e5 s) h. D
//速度(1-10)& Y8 W1 f, ~& U+ }! X" N
var marqueespeed=3
* S2 J8 S" z( w6 r8 I2 N0 f//背景颜色
1 l7 e/ e" w# H; u, J& e! c$ Zvar marqueebgcolor="#FFFFFF"
& ?8 L5 Y. g* Y% {/ {$ T//是否能暂停 (0=no. 1=yes)?
# k2 N/ H. \: _var pauseit=11 C, h& ?6 F4 d: H3 t3 J0 F
/ [7 H5 Q5 q2 _! G! y6 X
//修改显示内容3 @: o, e$ v) M  I: o9 u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' m  K; r: V5 A2 o, a

( h) m. S& F2 }$ }9 r' |  Y" J( C8 s; ~( s3 e% \
////下面不需改变////////////
6 W2 I/ \& ?7 v2 K) I$ P( l8 C  X; q% i; _( _" n7 j  \, f" J9 H2 ~! E
var copyspeed=marqueespeed
0 K# D3 K* }+ b  `5 j5 Lvar pausespeed=(pauseit==0)? copyspeed: 00 x9 d+ o' ^& ]. w! C
var iedom=document.all||document.getElementById/ L( }! {; p  u1 K
if (iedom)6 H+ Z* D* w2 W) _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; b% b) M4 j2 s8 U% r0 {: Rvar actualwidth=''( j3 r! `1 a, e# K3 ]
var cross_marquee, ns_marquee0 \  Z& J8 v1 q
7 v( w$ y3 X+ F
function populate(){; e/ _4 `  {: w8 b
if (iedom){4 C' @# |- G  l+ U: \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 T) V- t% w; V' Q* b) Kcross_marquee.style.left=marqueewidth+8
0 c2 f- H# a1 I. |8 k1 ?cross_marquee.innerHTML=marqueecontent
8 p" f; Q6 ~% n0 l6 D$ w9 j- `3 nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# n& u+ R& k' B
}& P* D" b, @$ a' X
else if (document.layers){' M% n: x; a% ~
ns_marquee=document.ns_marquee.document.ns_marquee2$ t' f- u0 u, y2 P
ns_marquee.left=marqueewidth+8( @; n/ G' y% L! X; I! ?
ns_marquee.document.write(marqueecontent)
; q  U1 d/ M, g/ p  Vns_marquee.document.close()+ y0 q- l) |4 D, I4 s$ D/ ]9 n' u% y
actualwidth=ns_marquee.document.width3 n7 ]' j9 a6 ^& G; a
}
" X4 c: @' n6 \! H; i$ jlefttime=setInterval("scrollmarquee()",20)6 a8 H& D- t. _: c9 g
}
$ D( ~+ U$ o5 f- m: ~! G+ G6 T8 ^window.onload=populate( V- c" K8 r& o3 ]
  L7 r5 J& w$ ^+ `2 {' o6 X# H
function scrollmarquee(){
2 o( u+ u  {4 w- k& nif (iedom){1 L' Z' u( h0 Q: V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( |( A& N% [+ b* i) }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# `9 ^  ?$ k; \* L2 Q
else2 l0 h4 F% h+ q+ O! i; \" `
cross_marquee.style.left=marqueewidth+85 k% K, Q# u5 w
) `$ O/ W  p. R  \5 h- v& J
}
: u, Q; S5 I, g  l) Uelse if (document.layers){
; h- O& f8 w/ D5 D- L( J- fif (ns_marquee.left>(actualwidth*(-1)+8))
. J7 v; J9 T. i( c5 i; c3 \2 m& Jns_marquee.left-=copyspeed8 {9 Q8 x- g3 ^7 `5 w% i
else
% \3 g+ m+ n8 ~4 M) V, u# kns_marquee.left=marqueewidth+8
; I* T- U  [& M3 H4 m% \}
1 S0 j0 Q+ U; u* ?& G: X) R}8 q. }; h" F! U0 Y) `7 V

: K+ J( I6 J4 ~. S- E4 ]: G% ~' s9 iif (iedom||document.layers){
0 v: b+ D+ i( n; G; q4 _with (document){
- s! R0 A6 f3 e9 Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 Y8 o3 Q4 _3 V& ?, t
if (iedom){
; \( T2 K' M: f* N( h. h: xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; S; C: m% D  U* D4 T; j6 B! Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& h  r$ p' A  D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' ^3 {. I. D; P, C0 ^  [6 d, _write('</div>')
! [2 Q2 A2 F5 \% m}
1 _# \3 [8 j/ w; Qelse if (document.layers){
7 c1 a" s( g* k* ~; Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ {" X1 {! b: G3 v+ \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 y+ V# T3 g* R: S6 v/ w! _- o5 s
write('</ilayer>')" @6 i- Q* r# g& ^/ t
}
5 Y# R* `8 F. Pdocument.write('</td></table>')  q8 [# `9 O6 g# }* k
}: Q9 B6 o. G3 O1 N( d- c
}
; P1 l: c! v4 v; W</script>

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