返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 Q  \8 S- R5 S3 N& V+ e  X, O. [
var marqueewidth=300
6 x/ u7 O. K4 J/ y0 W0 Y//高度) C1 R2 i& L7 y7 z
var marqueeheight=25
( }: J& K3 y! g$ l  |! @//速度(1-10)0 s0 x$ V8 {8 r9 Z
var marqueespeed=3
1 a: [8 d$ o$ f2 ?//背景颜色/ l: z/ \8 F* D  F
var marqueebgcolor="#FFFFFF"4 Z) U3 Y  B$ d/ x
//是否能暂停 (0=no. 1=yes)?
2 e/ J* h* `- w, {" i* ~( Ivar pauseit=1
6 T2 L9 m  Q, d5 t5 C& M4 T. W, j, R  j: V/ q
//修改显示内容3 W7 [0 Q6 ~2 x( e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 D6 _1 e2 Q% z2 |8 u7 N! k0 X& s* V1 r+ ~5 Q

' O! Q% F1 j7 ?- X' m( u9 X8 @////下面不需改变////////////$ a1 |' e1 X. o3 h3 s8 r* t

0 j8 ]8 d( v5 q' ~( @var copyspeed=marqueespeed6 Y* M( w- K; n4 l2 ], T/ Q
var pausespeed=(pauseit==0)? copyspeed: 0
. s7 w1 D6 S" `8 h4 l. Y- fvar iedom=document.all||document.getElementById
/ D5 H; R) S9 P2 Z2 Z. d1 @if (iedom)* u- i- M' S! o% Q9 {/ I- U; N6 p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 K" y* p$ @* ~: Fvar actualwidth=''  B0 d; K9 m8 }- J: H2 [6 A, E
var cross_marquee, ns_marquee6 b+ ]$ {) G; J' i

' r& ~' V8 p) N- |6 Y$ M6 hfunction populate(){3 V. t8 r5 b) A: z' _8 ?
if (iedom){
1 E0 f3 k3 C1 u. D. I- A  N3 pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" \& \; N6 f; V6 ^cross_marquee.style.left=marqueewidth+8( I6 W  D! h  s; t: c3 T3 [
cross_marquee.innerHTML=marqueecontent
) ~, E( K2 M' j% z( U9 c" pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* g/ p6 c9 c/ ~}& y, b6 P/ S' L, l. _, w6 R
else if (document.layers){
& D5 ?# p9 V7 }' F8 hns_marquee=document.ns_marquee.document.ns_marquee2: i- @* H" F0 V
ns_marquee.left=marqueewidth+8
! X, C. J8 t: \  p& \  Q! b# Vns_marquee.document.write(marqueecontent)' s0 f5 D9 R6 f+ J: q2 d
ns_marquee.document.close()
2 L4 W. j9 h9 Q. Yactualwidth=ns_marquee.document.width4 j5 a/ `3 h+ k
}
& N2 k- g: A8 xlefttime=setInterval("scrollmarquee()",20)
( H" E+ c7 p* k/ o4 o) f( C  \* U}
3 W  O& G6 p  Pwindow.onload=populate& c7 r5 b* [/ Y

1 n3 f8 J( U- ^$ M' P- R0 r. Rfunction scrollmarquee(){
8 {) i8 a' w- j" c, ?* `! \  _if (iedom){, }; P' d# L  x$ z9 r% R7 a. t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( \% _' @" S) h# F( o6 }3 c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: S5 ]8 \# v9 V3 x- G# S9 _else# }! L# ~6 f6 \
cross_marquee.style.left=marqueewidth+8
3 F* z3 |6 j" h. C1 [) s+ H5 d# x* S) m( w3 u" p# O9 b
}9 ~& C3 \7 y6 L3 D
else if (document.layers){' [9 ]) [, k; r" J/ }6 U7 i& |
if (ns_marquee.left>(actualwidth*(-1)+8))
6 g# S8 ?+ D. G- j+ }$ uns_marquee.left-=copyspeed
% }3 M8 u# J: _; felse
" _. c2 b; x& [) e6 J" z* Bns_marquee.left=marqueewidth+8
2 o( d: D$ d4 g, ?; P9 v}# _8 |8 @2 Y0 M2 t/ {& j1 g# h
}
4 Y+ H. C7 k: K* R  I
/ U) r/ R2 G* qif (iedom||document.layers){
2 g; o! Q* H% }7 _$ vwith (document){* I% v0 V9 u. E% W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 b. c/ P( G3 hif (iedom){# O$ B. m' ]6 y5 g$ Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" i, H' Z8 m6 K. [, d1 O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); E8 B" D, N" j4 w2 t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% }) f- t( D& e  p, b8 y7 Hwrite('</div>')5 S1 }; ^( v. r: d2 t5 G
}
3 N" J9 ]+ L2 C0 L( ~else if (document.layers){" a9 y9 C+ j% d* c- f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- @5 B9 C% \) J9 l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( h) P* _# |: c% Y1 B% twrite('</ilayer>')
# t% y+ ^4 u, [) R8 p}, O% O, S3 ?' Z8 M  j. w& p
document.write('</td></table>')
( _+ x' D, L; n7 K& {( w5 N3 e/ G}
% u8 [) a7 c! v) y1 l}4 @9 h3 M$ j$ Q9 I5 {6 b
</script>

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