返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 k/ K9 h. S1 j  z  c: |- z% Y( Nvar marqueewidth=3009 z% W% X/ i. Q* N0 y& X( _
//高度( M/ P( S; s# L, C
var marqueeheight=25
3 S% ^9 L: c# b5 q. Q! c//速度(1-10)
8 J" N4 t  P4 Avar marqueespeed=3% n, z' _8 |' ?' O
//背景颜色- b: U( H3 W: ?: Y
var marqueebgcolor="#FFFFFF"' z& ?+ c# w9 }+ p9 }1 g$ c
//是否能暂停 (0=no. 1=yes)?" r$ q0 o6 m( o9 \
var pauseit=1: X% P2 X! g; l

/ X9 t. ^. g3 z3 D  f) y' C//修改显示内容
: L5 ?1 H& Y/ ^4 L+ [% }: ]4 Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# T$ @& r: S/ g- D

; b0 }, K! L9 t7 u9 E) W+ @( V8 Q: J$ ~4 |& z$ a
////下面不需改变////////////
( n) S$ b8 w+ s' t& `6 P$ F! H- k" \! b0 o  B
var copyspeed=marqueespeed- ]# ^! B: D7 X* V  n
var pausespeed=(pauseit==0)? copyspeed: 0
& |' s7 M# h% M1 b/ Ivar iedom=document.all||document.getElementById
, ]; Z: [6 m/ y, Cif (iedom)/ Z. l) `* {5 S) P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ u; p+ y1 d: H5 R7 S
var actualwidth=''! V# @. a4 O" d2 }3 v
var cross_marquee, ns_marquee
) O4 H9 u' s$ J/ }1 f" k- V
5 [9 O. M$ e6 N+ P: ~9 `' R3 p3 Vfunction populate(){
, r0 m, \# {, o8 }# k$ R# H0 \if (iedom){. z2 P; a# z& N: i3 H- F5 ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& g) u' u6 J5 R/ P: b" C! f( ]' Ocross_marquee.style.left=marqueewidth+8
( W3 \: w0 q. B; P$ C! t6 Ccross_marquee.innerHTML=marqueecontent
3 l, i" J. ^3 Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 T. F! U5 z0 e* {}
* h, y& \! }6 Z# \: velse if (document.layers){2 S( R: W, f( U) c9 K# H/ p6 a- I6 ]
ns_marquee=document.ns_marquee.document.ns_marquee2
5 _# U' b/ z/ y5 o- G2 I; y+ Ins_marquee.left=marqueewidth+8* P. Z6 A" y+ p6 C
ns_marquee.document.write(marqueecontent)
* F- e) L8 B! N9 D/ v& q# P  mns_marquee.document.close(). i% E8 B9 O. F' [; f
actualwidth=ns_marquee.document.width/ m* V9 o: J" J" `; C
}% K; x0 t6 u% V
lefttime=setInterval("scrollmarquee()",20)
" f6 B2 k+ p  u/ z6 J* ^+ ?, t}! x$ a, T; u* {5 T
window.onload=populate5 h1 R/ Z; I( V7 `: E' B
. \, }. G# J/ a! ?
function scrollmarquee(){
7 \! A/ g5 }/ w9 a8 Lif (iedom){1 P7 [# w3 g2 T2 y. F1 J- U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* e4 P3 }- Z3 d& |+ P1 ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. i6 i/ [; ^) d6 L6 @! R
else
( Q7 W4 a# K" t5 G% j& Vcross_marquee.style.left=marqueewidth+8
2 ~' V8 `, t2 Y0 \
6 a6 j& S  L- [6 O2 ^7 _# U! J}# `3 v) L. t7 H8 `  A$ `) N
else if (document.layers){
4 B! K/ z& Y0 x. |" P6 Tif (ns_marquee.left>(actualwidth*(-1)+8))- s% I, L, B/ z+ \
ns_marquee.left-=copyspeed0 K4 V0 {2 s4 q% s5 w: Z4 G
else' p: K" r( p) G( c3 _8 a0 ]- R% u
ns_marquee.left=marqueewidth+86 l: a4 y* h! G  d0 R' k
}# Q3 H, a9 x$ V% C# b, g
}( _7 e1 u% t  i
! D; o' A. R! x
if (iedom||document.layers){! @4 p8 U5 S4 z4 x3 q$ R
with (document){
0 `" z8 u- F; A* p$ k/ Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. u7 f# d  w1 R, s, B5 rif (iedom){" t, F* g' O3 e9 y! j# s, z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# [* T* G# r/ L8 |% N! @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) H) Z: L9 Q: I2 N* y0 z& Q( [8 O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 D1 p6 ?1 K. ?' M" b
write('</div>')
) O7 M+ I# B% [. _) h/ q}1 u( I' ~: y# x! c% F0 N; ?: p
else if (document.layers){
* P- ~- m, x3 w: H) rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% D3 K0 m: V% g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 ^. ^) f0 D# c5 ]write('</ilayer>'); Y8 [' l7 l( C# r" ]( ]
}
# A1 J" T9 e( y; r# mdocument.write('</td></table>')
: ~: o+ t1 ?" o, u# p}
0 B! M  L" P4 k; O3 |/ m+ Y}: W7 v' ]2 ]1 ^0 L; ?
</script>

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