返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% s1 ], S. c# w- p/ s$ Avar marqueewidth=300
+ Q5 ?9 W$ G# e1 Y  p//高度5 T1 V: ?; U- }
var marqueeheight=25
' z3 b3 Q* E9 t# }4 w2 w//速度(1-10)
' O& u5 _! T+ U8 G2 t; w  Kvar marqueespeed=3$ W( V( E* U7 H. h& |6 P
//背景颜色
0 Z# @2 i. ]/ G9 k, W# Qvar marqueebgcolor="#FFFFFF"( b. p' n0 y7 V; I
//是否能暂停 (0=no. 1=yes)?9 u% S/ J2 ~0 v7 G
var pauseit=1
5 W9 T, d: \$ ]  O4 [- F* n; |+ ?/ x/ n6 `8 ^1 ?. r
//修改显示内容
4 K# U$ H" `+ ^  g2 q& jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 L  [$ ]2 @$ ^) Y- Z& t( h; m4 N

9 h8 j* J; C( h# J! S
* E1 r) E- @+ O4 E////下面不需改变////////////
) O' M; y, |/ D8 R
5 z5 @' M2 h) m  i& [0 lvar copyspeed=marqueespeed( b6 p+ Z* v' ~  E/ P4 |# O# P5 ^& w' I
var pausespeed=(pauseit==0)? copyspeed: 0/ |! P$ h4 b" T
var iedom=document.all||document.getElementById) b5 J) \0 u7 @! P: m* ^
if (iedom)! x- H! `; z" \, R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 u  M! F( G* }8 c* i/ t! u) Z0 Avar actualwidth=''
* [5 s, ]- [. j2 u9 |+ `! @, A* Lvar cross_marquee, ns_marquee/ l. z% q& y; N3 o

1 c4 F( ^- G7 Q6 X2 e0 Dfunction populate(){
4 O* G4 {) }6 d+ V: tif (iedom){
* X$ C9 }# j. l: r, Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: i7 _! X- y: w9 z
cross_marquee.style.left=marqueewidth+87 h0 W/ h" I* M% r9 B
cross_marquee.innerHTML=marqueecontent
1 O2 l! h1 u. p( Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ R2 t# H' w1 q3 m( ^4 S* B! C}& j- k, @. L2 l' }2 e# h8 J0 |4 S( l
else if (document.layers){
2 D* H1 x1 w. }& D9 S  ons_marquee=document.ns_marquee.document.ns_marquee2
/ u: X' b1 _: e0 T/ `  A3 Xns_marquee.left=marqueewidth+8
' J2 y7 f$ e7 n7 }ns_marquee.document.write(marqueecontent); [/ }0 Z  B4 T0 Y/ @% d
ns_marquee.document.close()9 c7 ?9 p7 ^$ W" V( K. M
actualwidth=ns_marquee.document.width! c' r0 b: D1 h2 @7 H
}! v* v! R# S( ~( R" y
lefttime=setInterval("scrollmarquee()",20)5 O+ e. h1 g" a( M- A7 C# y! d% P
}8 i. J6 f. k$ n* m  E! c9 n" ^
window.onload=populate( }( L1 P, p7 h& v& O. x
3 |# C- w, H0 m5 X5 m! s
function scrollmarquee(){
0 z+ W1 z: w+ N2 z' x& b4 E0 xif (iedom){6 N/ f) f& |" W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); g4 x9 i7 R$ I( X; l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 G- B6 z+ d5 O; J4 z: ?
else
; c  t: _% o' ?# _3 ccross_marquee.style.left=marqueewidth+8
. X" u4 X* H! }; v- S! @, I; t$ I8 q7 Y" S
}
2 a3 [* X! _  z$ O& \! h3 k: U& ?else if (document.layers){
4 _1 X/ Z# ?4 l! w. g& O! W! K9 _' ]if (ns_marquee.left>(actualwidth*(-1)+8))8 ~- g  U9 X2 _- k2 ?
ns_marquee.left-=copyspeed
' k+ l* o, l. U1 belse( v0 \: H8 b% U4 E$ r! ~6 k1 `) a( s( K
ns_marquee.left=marqueewidth+8& @- C7 ]  q0 J! [' m# z
}  c% e# M" e, |' W4 ^
}: ]" T, L2 F$ U
% m+ m, s' R4 [1 L8 P
if (iedom||document.layers){
3 E% C) w+ R8 pwith (document){  K. R$ {3 d! M9 j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 R4 V! E- M& k/ r" Cif (iedom){8 u; u0 {4 V) ]3 t2 ~, F& I/ r/ J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ p3 o6 R) E' Q* ?/ g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 m- W6 t* h! T" C( s5 Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  j6 X; T: Z3 P6 K1 T# E
write('</div>')
; u# r8 F/ F, D}3 Y  e, X7 }: K+ i$ m: F
else if (document.layers){
+ l3 x9 s' N1 ^5 g, @* n& w+ h- X/ ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; o2 r; P, u# F$ f& Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% E% W" X  `! y0 T! E0 iwrite('</ilayer>')
5 K6 A8 F8 n7 e/ Z/ s- e" m}2 j( Y/ G, C+ f. g+ \+ A
document.write('</td></table>')% V% z; M9 N6 V
}( x# H  t% y7 Z, d& V, `! y
}* J8 h. l" p7 N% c
</script>

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