返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; s/ I3 x8 T! pvar marqueewidth=300
: R* Y) y, t: A5 Y; }//高度% j( x( O5 Q3 H% A' E2 t& ~
var marqueeheight=25
' T6 q1 Z( Z+ y6 b7 [; l//速度(1-10): {6 U, q1 K4 t
var marqueespeed=3
) N' ^  x" M- a( t1 v//背景颜色, _) T6 v! ^  L$ o* d/ z0 M# L- e
var marqueebgcolor="#FFFFFF"9 y# F% Q; I: Z; [9 i+ B
//是否能暂停 (0=no. 1=yes)?. m: J. ~5 a7 I9 h" C% [
var pauseit=1  n, B% W8 j9 V( @7 K2 r9 L
2 p+ D# z2 b, P  Q2 F
//修改显示内容2 M$ p+ J1 ~! P6 ?' ^9 z' ?& u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 c: v) v& \' x  p

7 Y$ X& v7 L) }" {. L
4 z  U, W- H/ b////下面不需改变////////////
% @+ f; l3 Q& |/ M" x3 X/ r$ B6 V* ~7 D( k5 A' G$ S
var copyspeed=marqueespeed) v# o; c9 W7 \/ b# |
var pausespeed=(pauseit==0)? copyspeed: 09 D3 x) {! L# c7 ^
var iedom=document.all||document.getElementById
, ?3 ^! s  R% W5 x* t0 yif (iedom)
' B" h7 R8 c* d, ^% }document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). G4 Y$ \9 u) j
var actualwidth=''$ i) y! L: B, J2 q( [7 j
var cross_marquee, ns_marquee
4 {8 ]5 t; X. K8 S; k2 j7 i8 f# L8 `: N' X1 X0 O8 E. y
function populate(){3 A( y9 e" |. I- U3 G
if (iedom){
6 C5 b+ D3 ^# k5 Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ A/ k/ F$ G/ scross_marquee.style.left=marqueewidth+8
0 A7 Q2 _7 `0 \# M: i2 f5 hcross_marquee.innerHTML=marqueecontent; ]" W1 c; _9 N% t1 J- R- ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% X# S5 j. }: a6 E: g8 B
}
5 v, i3 y8 t4 V- g: l  r5 zelse if (document.layers){
; b. K1 j7 Z* e$ Q! U; Pns_marquee=document.ns_marquee.document.ns_marquee2- b  X' n" [5 A$ y% r" S8 h
ns_marquee.left=marqueewidth+8
6 K1 y4 V7 ~& Cns_marquee.document.write(marqueecontent)7 t8 K5 D* a' p  M3 A
ns_marquee.document.close()/ E5 r, X0 x( e$ a; e" d+ J
actualwidth=ns_marquee.document.width
- }( i" |' ]# U& C! y}
+ |$ [0 z: c, y9 W* l+ _lefttime=setInterval("scrollmarquee()",20)8 q/ G7 [$ t2 A  p7 i. w7 C/ _
}
& b7 ?! j1 V) _window.onload=populate( R) P1 E, G& t4 O5 u

9 }/ H6 Z* ?6 g) y( `function scrollmarquee(){
7 \5 x6 q8 ~0 [% {9 L. ^5 v1 iif (iedom){
$ n) [, \* ]6 D; ]* s! D- d; wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 F0 }3 W" A8 N+ r" a# ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; D" M9 W: o! L4 \else8 G" _% i' h  A* |- w
cross_marquee.style.left=marqueewidth+8
. K. x2 D! I) B/ A- N7 U9 {( _; \1 J' I. i# f
}
1 j' ]% i1 }. |' r% X* melse if (document.layers){
* N; n5 v5 }+ @6 W( kif (ns_marquee.left>(actualwidth*(-1)+8))
! ~6 V. Y4 t! Y+ d) s/ c& @  M. cns_marquee.left-=copyspeed
9 R( Y+ C+ b( _3 ]" jelse5 j' G/ S' L( S0 d5 v' Y/ b
ns_marquee.left=marqueewidth+81 q% S# g1 i3 g7 v. y& e
}
1 M+ N/ j6 s) m+ T; Z( y* Q}: D7 u6 r5 T9 z. ^

6 Q9 _+ W! B3 s9 f% P* f0 Hif (iedom||document.layers){, Y. A2 y8 L* {. F
with (document){6 z% q8 M+ ?. Z. ?) s4 M; M0 s2 ]; |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 _5 C% L4 b* A+ R1 T
if (iedom){2 u% v0 ^& K7 t  y0 n( |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# f1 r6 k/ {) U& M) j; D% b& a: `, B3 Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& n2 n2 e) ]" Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 c# |" V+ e2 T1 @, Q2 D) W
write('</div>')& b3 ?& e# y4 m/ h/ c
}% ^# T, w% q& K: V" c& |
else if (document.layers){! R* A: L. V2 R& R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' C/ p! r- B  s3 j4 D% F1 H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% ]. b' l) ]- m$ q. i9 n8 q( ~write('</ilayer>')
2 o( m+ I6 B& i, B+ @, _}5 X) f) R" M! E3 i
document.write('</td></table>')
/ w4 X# E9 a6 g}
2 i' U0 ^8 r' L}* z# M/ c: z' g2 W( H3 o
</script>

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