返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 A- e- N; i2 v9 L
var marqueewidth=300" C, J/ R" H7 j, Z$ n# f3 H
//高度
* o% N0 W# e# A) @var marqueeheight=25
& m4 ]* V- y4 ~$ p& y" H! f//速度(1-10)+ {8 f+ H* C2 ^; t) W# \
var marqueespeed=3
) t  D, L0 T, v( m1 [- U. u' X//背景颜色( R  k% B7 U  [
var marqueebgcolor="#FFFFFF"
/ A6 u; |- k8 r//是否能暂停 (0=no. 1=yes)?3 H) U6 T9 r5 c" I" M
var pauseit=1
& u+ m/ U2 V* x% Y1 Q( T1 z+ i$ F# W7 n. s
//修改显示内容; F1 J4 e0 W1 z! a: b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 r# f: R3 L$ ]" c& [$ Q. ]7 y; O! s2 ]3 n8 ^# U" t' L; y; v
; |) X7 x6 P8 q% n
////下面不需改变////////////
2 X( V4 H! K, a7 l0 r
3 N2 W* W6 Q: Z. `1 [! Tvar copyspeed=marqueespeed9 Q# o4 M% f; x
var pausespeed=(pauseit==0)? copyspeed: 0
' U$ E8 \& q. ?7 C* o+ }3 v9 l" Hvar iedom=document.all||document.getElementById% u: |8 u4 R% H( Q$ Q/ \3 d
if (iedom)6 k) G/ @8 G4 i$ Z# N0 ?7 G1 j8 S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- _3 z' z9 {+ A9 Ovar actualwidth=''0 p# w# R: x5 ]3 I7 W+ H# f
var cross_marquee, ns_marquee
# U( k2 G' Y, n: \8 Z- G7 r/ U, D* h# R1 S: V4 T
function populate(){
& P: h0 |/ Q4 b8 F# ~if (iedom){
' H2 u/ p5 W9 S9 L2 ]- R9 Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 `  ~* E) {8 A' Y4 h' M$ rcross_marquee.style.left=marqueewidth+8$ F" o2 j( T2 @
cross_marquee.innerHTML=marqueecontent
& X, X4 V# ~( h: P( a# iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% A2 ?* W4 e# ?8 y6 D  P
}
' Q9 S. x* @' s; b# G6 Jelse if (document.layers){, B& S: q6 a' ?; i3 U9 K5 A4 O- |
ns_marquee=document.ns_marquee.document.ns_marquee2
3 X$ `4 g/ j# ~' ^7 R3 ins_marquee.left=marqueewidth+8
' M3 X  W0 G# U  Z# `ns_marquee.document.write(marqueecontent)# L% Y& W" I$ S. K  k% O
ns_marquee.document.close()
8 M6 T) j! D# s; x) {. r. K4 nactualwidth=ns_marquee.document.width
4 a5 _* ^" ^  _% h3 J4 \}
' E. @# X1 ^4 l! elefttime=setInterval("scrollmarquee()",20)( ~4 J5 k7 t0 R" d9 }
}
3 X& Q7 [* \! n0 u5 g3 Wwindow.onload=populate/ v$ W! O1 q8 `5 r& D# k* l$ `

( f( P, d# d5 \4 K! z0 p! y0 [; ^function scrollmarquee(){( s/ g2 _" G; _) g$ ^3 m: H' N
if (iedom){$ {7 r" q3 x! G! X7 E9 ?+ @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 h* R" H3 O+ `# H1 Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 d# G+ R3 g$ B5 K# {# relse8 }7 S! j, [% [" e
cross_marquee.style.left=marqueewidth+8
7 i0 V) n' @& ^$ N: h& l1 x; F5 @0 q  X2 X' G% s: Q
}8 {) B" |2 U0 b3 W5 E
else if (document.layers){
: J. l+ E2 Y6 @9 Uif (ns_marquee.left>(actualwidth*(-1)+8))# o- o* r% g& Q. R
ns_marquee.left-=copyspeed$ U: h1 ?$ F0 x& a
else
; ?* e; ~; b1 \3 I% Cns_marquee.left=marqueewidth+8" V" \: w. J" I+ q/ J5 W  N
}/ H3 \* i1 a9 u3 K6 d; e
}& X9 k5 f. r% G; z& Y
3 }* K. r" u' I
if (iedom||document.layers){
' m) @8 u. ]' B) _2 k' Nwith (document){
3 K2 L& y* v4 N4 J$ [1 g  Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 z& X/ B  I. A% r" |& H) x( Dif (iedom){
9 ^  S! |) c, q* u$ F' @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 _% _1 r# L7 Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" S  _2 h8 T7 P; |0 m- k4 n- ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) F6 P7 z0 Y# Q- M$ f0 w" jwrite('</div>')
9 ]- [1 ]9 i! M1 f5 }' S8 D# Z}
7 a# d' v4 F3 C6 jelse if (document.layers){4 t9 }+ X3 p% r5 Y' C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& d2 v  y; b1 ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 r: F; O# R) z8 Y' C6 h  T
write('</ilayer>')
% \" p7 p8 g; e. \+ T0 e& D}
# K* I/ q& i6 ], F3 j, e) {8 V7 _! rdocument.write('</td></table>')# X" p% y7 @1 _8 k, h
}( L- @6 ~" v' p; I' f& \8 N
}
# d* o* A9 Y# Q' T. b5 U, ]</script>

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