返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ D3 T' X& W7 A7 k
var marqueewidth=300
% [; s9 y/ Q  U! f, `& G: M& c//高度
9 q* `& h! {! M4 D( D& wvar marqueeheight=25
7 Y! Y( q/ G. X" h5 S//速度(1-10)
3 N2 F* O: {  M- Kvar marqueespeed=3# h( x( _7 ^- U* e0 S4 t
//背景颜色+ v6 _5 g3 m% J' l/ \
var marqueebgcolor="#FFFFFF"  M. G2 O* e& t* d$ F, |  b3 E9 D
//是否能暂停 (0=no. 1=yes)?' X$ a4 X; F3 L* A7 p7 _
var pauseit=17 x6 r0 O- r1 g; l9 T! ~
8 s% \# D4 N: S3 P7 D
//修改显示内容
/ |! O" S0 }8 ~2 p: t8 yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 e) L3 D+ U- q5 u: h
1 m/ X+ r7 y; O
$ j& A$ g5 J& h1 g3 [
////下面不需改变////////////9 b9 j' `& Y2 R, i
/ s+ [# J- g0 b- m- J0 H; q
var copyspeed=marqueespeed
- A! p+ A! F1 b/ O6 {" S% t" l' hvar pausespeed=(pauseit==0)? copyspeed: 0
* l+ ~% {- l, B. M9 Hvar iedom=document.all||document.getElementById
" t3 l) ]+ s7 s- l8 V1 jif (iedom); D0 ^3 C/ T  i; K" J. F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: g1 T& e" Q) m0 E+ |1 bvar actualwidth='') Y7 F0 @# _% Z( m. a
var cross_marquee, ns_marquee2 _7 B9 \' `0 b8 `

3 ]; R4 p3 v0 ~2 ffunction populate(){0 g) n' g! K2 K, l
if (iedom){( ~9 m, l$ @6 [" m/ g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ g: \1 A) N' L+ w" H6 g6 K+ hcross_marquee.style.left=marqueewidth+8
% {2 j8 N4 B/ b$ p+ Icross_marquee.innerHTML=marqueecontent
' e: I1 L3 s0 P# j5 |8 nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 b0 d, j8 p; F5 K8 g% t4 V}
6 _# ]; N2 ]+ E% h3 ]# Delse if (document.layers){
" ^( X' d6 b9 D2 o: v1 W4 v: `* U. nns_marquee=document.ns_marquee.document.ns_marquee2, [6 _& z% y1 J% s5 C
ns_marquee.left=marqueewidth+8
2 }3 G1 y, N! D% x( @. [& yns_marquee.document.write(marqueecontent)
: e% y6 a& n  K, ans_marquee.document.close()3 S9 p# a% y0 M0 J& M; {
actualwidth=ns_marquee.document.width. k! L0 n3 M( ]. o, |
}
5 n- l0 c" B: e- D( D# ~" flefttime=setInterval("scrollmarquee()",20)" ~9 q: F% e, l2 k
}) Y  G; F, R! v8 t: ?
window.onload=populate
& t$ r0 T* B# [  J1 H1 Y8 J: t2 o. o! O  s& w
function scrollmarquee(){
- {7 E1 f% z0 U9 l7 b1 Mif (iedom){
6 ^# i1 M1 g% a# d2 S/ N2 _1 Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' V' n8 J* a! N( T) Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ O7 X# s! E5 w6 ], n3 }else! g( Q3 b% n, O. C+ o
cross_marquee.style.left=marqueewidth+8* ?, S, ]5 T# q0 K0 r

0 c" g' V0 B' l3 m5 W}$ @; M& f+ S: n! E. y
else if (document.layers){" n6 S* H6 J- B5 x
if (ns_marquee.left>(actualwidth*(-1)+8))9 c. d; c% T: o5 L- l# D
ns_marquee.left-=copyspeed, j" K+ z1 g0 w) b0 p4 ?
else8 y6 b7 C3 b( ^* O+ `
ns_marquee.left=marqueewidth+8
. i2 P* _$ q' }$ b# c7 e}1 m8 p& `" x% U! ^
}
( X3 O1 j4 E& x3 n! F7 b0 i6 f; {1 [" C! g& d
if (iedom||document.layers){
6 Z6 B$ J8 f, h+ m, n# ?with (document){
7 w* K# Q7 \" ?* a' ^  Z) z, H3 C. Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 v3 b7 b. u5 G& {# Jif (iedom){6 Z$ R* g# j& Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 s) z! j4 L8 X7 x" @( h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 \  P+ m1 `& Q9 q: \8 Q1 ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) x, F/ \) u3 _write('</div>')
4 b' k# [) Z; x* G4 e}7 b- l6 C; z& O9 g
else if (document.layers){& P/ p+ l! j5 R  v: c' ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! J) k% j0 N) e6 Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 z/ P/ N  w  v/ T9 C2 Z' ?  o- \; {
write('</ilayer>')& R, ^3 H& ?4 M8 `5 {
}( A5 n* `4 k* o& t% e
document.write('</td></table>')
7 d3 p+ V6 L) W, N8 T! W2 S! K}% z2 I$ W, {5 {/ s
}6 [( E  r& C+ Z* _. {5 e6 @
</script>

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