返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 Q8 `7 E- _, B  S& R; ~
var marqueewidth=300% I$ x- p9 S. p5 v  X+ m  P* a
//高度
# d: A& U; u) v" @, a5 ^var marqueeheight=25% `1 k1 x  I" |- M9 i* [1 T
//速度(1-10)
8 f! k; j! w$ cvar marqueespeed=3
* [2 b" l1 R% v2 b2 t6 {' b, C//背景颜色
- h- U; E  Z( F) m0 F  Yvar marqueebgcolor="#FFFFFF"  R2 p2 ?5 k' V; k" q$ c
//是否能暂停 (0=no. 1=yes)?/ w$ w2 z. V1 `0 `! H( y6 L% g
var pauseit=1
3 y7 F, ?8 }# t6 l% {3 b; ]: m
0 d* g! l8 O4 r7 R* _2 ?9 n//修改显示内容6 F' p4 S* }: i+ ^- K% H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') b+ o. l: X: L7 T4 c/ Z7 o# P. l
/ p( {2 o4 o& t5 o6 `; @

& t: b" N, {" t" V8 P/ u; f////下面不需改变////////////
3 H/ t( h6 e5 {  k2 R5 N8 ~% g
var copyspeed=marqueespeed
9 H# k" C# f/ S6 t3 Vvar pausespeed=(pauseit==0)? copyspeed: 0
& d) _9 _5 s7 P8 d- p9 uvar iedom=document.all||document.getElementById" t; s8 K) Y' Z6 y) V
if (iedom)
8 W( z& u. I/ e$ ?3 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 K5 Q3 T" e7 O2 V1 i9 g' Svar actualwidth=''1 @' P/ J0 [, ~# C/ u7 C
var cross_marquee, ns_marquee
! |; V$ s3 O3 \2 C' o# U* H& A, V
$ ]( y8 X8 @' q7 K' lfunction populate(){# X* Z7 m4 H& \" F2 i
if (iedom){0 u) \- t7 f; d( Z' I) [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& j8 h  @4 u3 I  t7 W$ Ocross_marquee.style.left=marqueewidth+83 @, X' V! h# t" H, f7 o
cross_marquee.innerHTML=marqueecontent3 j6 G5 D; P! }/ Z! Q. J0 F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 C9 L% j1 R3 k3 w6 w/ S6 Q, P
}
& H. _  W2 o$ |5 eelse if (document.layers){
6 f+ v& b% J/ ]/ y( {ns_marquee=document.ns_marquee.document.ns_marquee2
6 B. b3 Y7 h5 S) Vns_marquee.left=marqueewidth+8  \6 K& l( l. H* d6 T
ns_marquee.document.write(marqueecontent)
' S7 C9 m9 X( l- y4 v9 }9 M9 @2 ~ns_marquee.document.close()
" }8 v8 j+ _& F& w* y* Qactualwidth=ns_marquee.document.width2 ]2 ?" x* V0 b) |# n
}# d! G) u+ A8 {, |) l/ J& r
lefttime=setInterval("scrollmarquee()",20)
3 y" K6 ]. H5 |0 F4 U% r. H3 ^8 E}
& A* \0 D7 Q+ v: jwindow.onload=populate
/ j6 @4 c3 ~2 C7 U0 O2 ^- g
0 D1 D8 Z; [; |, F( R' \function scrollmarquee(){
$ ?/ ~( |  K  b# [if (iedom){
# B; M& m) d0 ?7 p+ e5 dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& [6 w" x$ u; x: \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# ~% G0 d9 W% T6 d3 ?* eelse- W2 [4 {) I% \% H( W# y
cross_marquee.style.left=marqueewidth+8+ l; U9 u+ B" R. G4 c

; U& p( h, U4 [' R) C}2 F+ T- O( H; U- J9 b  ~
else if (document.layers){
: ^6 r( y+ x0 h8 c3 z/ zif (ns_marquee.left>(actualwidth*(-1)+8))- m# f3 ?/ W; I9 n" E1 ]6 E; H
ns_marquee.left-=copyspeed8 c# d) L7 N* m: q. M; ?, E
else
: x) e9 W# o7 Ens_marquee.left=marqueewidth+8& C% |6 F# F6 L, G3 A6 ?, J3 S7 g* H
}3 \% P0 L& K. F( s0 d! T& n* L8 U4 U
}4 q$ j( i6 s/ b8 Q# f& ?

9 W( s  k$ s7 g; f" ^if (iedom||document.layers){# o8 F+ {1 Z- u# X8 }
with (document){
! s4 I6 B. m0 R& i: @$ ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ ]9 Q! ~1 i6 p7 @8 Yif (iedom){
8 `% f( M9 d6 N1 Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* ~/ M* w! O( ?0 V% s) C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! P4 ?+ L7 f* E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' ?% L8 b$ L8 h) D6 g1 N4 m: w  q
write('</div>')
) M" h) g7 p/ e5 i}
8 X! ]# F+ q+ H8 Ielse if (document.layers){" H7 O6 Y  Z! w3 y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 R  b5 t6 s; m0 R- V7 G/ i3 Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! `4 q6 t* ^6 X& q& h) K- ]& Lwrite('</ilayer>')
" |. Z( x4 }' l& }7 W5 B; S8 o}0 J( H  R# X  T
document.write('</td></table>')8 E; Q, P8 _2 c
}, _  j2 E* \, T
}  M5 k; y( x" h5 \6 W
</script>

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