返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 L) ?! v# y% nvar marqueewidth=300
2 M0 N  g# f, _4 E//高度1 e8 M" T. x6 }" B
var marqueeheight=25, `5 F" ~- e  @4 v
//速度(1-10); R5 a( K8 T( l! U/ R, a6 G
var marqueespeed=30 I- [9 w9 w" }0 C* m% l6 F" G) \
//背景颜色; K1 Y9 c1 ^! Z, l0 u( r
var marqueebgcolor="#FFFFFF"& _$ s) {. {2 w/ k. m$ S; i7 B
//是否能暂停 (0=no. 1=yes)?
/ v+ u' [* I5 R1 |var pauseit=1$ r7 S, s! @3 W5 z( K

: e- S* Q& `4 C7 G! v/ N//修改显示内容4 M; x$ j7 }% u1 U$ A+ ]# m2 L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', N1 b" X1 }/ Y% n% K( R3 I4 A# r

+ w( w& q" x: C4 f$ A. f5 U7 B2 L" L
////下面不需改变////////////
" W# @2 _# G/ F( z  P, U# i! U$ n1 \
var copyspeed=marqueespeed" e5 H$ V: q' X
var pausespeed=(pauseit==0)? copyspeed: 0
6 E, m7 g! z  Q; ivar iedom=document.all||document.getElementById; Q0 t  @6 y' O
if (iedom)) T* L0 J7 B  L" h) \# W% B- T) Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 d  h' d1 u+ ]. j
var actualwidth=''
! W% B! }( _* dvar cross_marquee, ns_marquee" {( b7 \/ ]9 H. O2 h9 H

7 {1 h) u4 t" Yfunction populate(){
) O- H" m  I* i/ pif (iedom){
) k/ M: L7 G6 F7 O, |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 O3 ~- o7 X0 _cross_marquee.style.left=marqueewidth+8
, N2 f6 w' [  Y7 A" Kcross_marquee.innerHTML=marqueecontent) U( U( f+ U5 ?# B) X' {7 D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" P3 w6 q) Y0 A
}4 x0 f8 X3 I; @3 a
else if (document.layers){; C  I2 l% i; ~  \7 e- x! J
ns_marquee=document.ns_marquee.document.ns_marquee2
8 t" q1 z" G0 A4 W6 Q( c2 Wns_marquee.left=marqueewidth+8) n' b( v% ~/ P% b$ e, n
ns_marquee.document.write(marqueecontent)( H, K0 O1 d4 V0 L$ |0 w
ns_marquee.document.close()
; j& w1 C6 y+ ^0 O, Aactualwidth=ns_marquee.document.width0 H: M9 t% n3 W- Q! n1 u/ i& z3 O
}. l- z- J& N3 H8 T3 T6 |+ t
lefttime=setInterval("scrollmarquee()",20)
4 h8 Y9 S4 P4 x) n- |2 g; G5 F1 J4 Z}2 V2 ]0 Q) w7 ^, I' I6 w6 X
window.onload=populate
6 k$ n. R: Y% p0 v1 i2 y$ j
2 U2 Q' [% N4 |" F3 [# qfunction scrollmarquee(){: @! N0 |0 H6 F% W: H& d8 U. u/ R' z
if (iedom){  z  s" o- b- C3 q( U8 R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 w% q. r) _8 a, Q# Y! ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' T6 x- R4 @* a  ~* y! helse7 d6 Q2 q. G) f1 G* V$ N- z
cross_marquee.style.left=marqueewidth+81 t+ M' j. |( d8 Y+ Q
/ R; V. T+ d  q6 W; H
}
5 W1 U3 E  R  m  J# T: ]else if (document.layers){" h# R- i7 K& o9 ?# W8 Y+ U
if (ns_marquee.left>(actualwidth*(-1)+8))! i0 L- Y  t  E# A% d7 e
ns_marquee.left-=copyspeed1 z! a2 H$ f$ z
else* R# a3 D  V( M3 s+ {# P
ns_marquee.left=marqueewidth+8/ _) I4 @" M$ ^, x: u# G* L3 k+ o
}
1 m# o% `3 L# [, j7 }# g8 H6 |. I% ]}
2 L4 `: ]3 H- g9 q6 ]
- s8 i4 L* `0 R# f6 fif (iedom||document.layers){% h- m! [3 Y) e/ t; n: u! e
with (document){* A+ W& {- h0 |9 A9 K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), K/ {2 [8 ?& f1 H& u) [
if (iedom){/ l& R3 S& j  |. z, S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) \+ Y! Q' C1 j- P) y% o6 l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" j0 V9 z& h0 N$ ~: dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 n6 w. B; {: m; ]
write('</div>')
' D9 o+ h: `9 V: j6 X; z}$ a0 w$ j. U* ]1 J2 t
else if (document.layers){8 o( U" b, \; s5 k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, e/ m* M( f5 y: ^! v. Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 S* u3 M+ h0 ^8 F
write('</ilayer>')
! i( W! D0 _4 V5 o7 M}! y' m3 f6 m& @. w
document.write('</td></table>')) t% T0 E# R% O8 X* L$ Z0 }
}
! J7 Y) ^. s, L+ G/ @8 Q& ?- C}
1 }/ n9 ]8 D; f/ c. W</script>

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