返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; H* `# u. c6 i) `* Z" rvar marqueewidth=300
+ }9 _0 q7 L: r4 p3 ^//高度
0 e3 F& T& r7 J# r! n0 dvar marqueeheight=25" W( Q# c/ t' |# V& Z
//速度(1-10)
7 A+ s: B% x9 _0 Gvar marqueespeed=3& a. P" t. E: _5 {% t
//背景颜色$ ^6 n& s% {( q, K
var marqueebgcolor="#FFFFFF"  ^4 i2 j/ i  P2 y0 G% e
//是否能暂停 (0=no. 1=yes)?* d' y, `$ A1 B  Y
var pauseit=16 y( T4 H+ [! m8 d

  Y; c0 B5 q% Q* y! E- C, U& N//修改显示内容
2 v" e8 k0 u% K! M  f0 F) T8 U0 P8 T( Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, V: z  ]2 c1 H8 l# B* `' O
& `6 p" F/ n7 m( G; |
' h3 G: {. E" @$ d4 j9 t/ _5 g////下面不需改变////////////
7 t* B  w: M9 w0 Q
; X0 u6 g2 p4 i' Q: v4 Z" cvar copyspeed=marqueespeed1 m+ a7 ]) ^* t# y2 l* G" p
var pausespeed=(pauseit==0)? copyspeed: 0
7 q- \( Q5 G; J! Gvar iedom=document.all||document.getElementById; D: D" m8 ~6 p% |# t: {9 X* L
if (iedom); N9 e; M$ |& J' T* x8 V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. d* W  g; ^1 V) jvar actualwidth='': G- \/ H3 U3 r& @2 v* N
var cross_marquee, ns_marquee
- C; s' Q" V/ G% ^/ X7 a7 x% ~$ w) m% E* p
function populate(){9 i* ~2 ]5 t1 ?* @/ x0 F
if (iedom){( t% O5 @/ D9 L! Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' S) i/ t0 o8 G
cross_marquee.style.left=marqueewidth+8
! L9 ^7 @$ D" z, T' gcross_marquee.innerHTML=marqueecontent4 {( r5 J* o2 B+ _- ^+ r( }6 M9 E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 [( _6 v- ?1 m8 @8 Z+ Q0 c$ Z" d
}
" u* @, c: p6 a9 f; }else if (document.layers){: E) |# ]% \, R  |" y$ B
ns_marquee=document.ns_marquee.document.ns_marquee2
- Z9 E- x$ |- H7 z! q2 g6 nns_marquee.left=marqueewidth+8
$ g  D5 A$ `. F2 r" \; rns_marquee.document.write(marqueecontent)# I% S0 \" w+ ?, }
ns_marquee.document.close()
3 @8 J1 C7 t6 {% J, Lactualwidth=ns_marquee.document.width$ D1 \" |. k3 L, E
}9 e  U! v7 E- q" [) p# [# a) B
lefttime=setInterval("scrollmarquee()",20)' r1 G# f, x! S6 v- z
}
! x# n+ d! H$ p8 qwindow.onload=populate5 V" C0 A1 t# }% f8 G

. `5 c9 D7 ^+ T: j- T8 o. e1 v* L: M$ Tfunction scrollmarquee(){
3 Q% _% M7 C/ f0 Q- hif (iedom){/ u7 Y: \8 q& p; }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 U0 D/ J! j" J: dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ G! f1 ^2 k; b7 r* _& Gelse: v2 T# [  i" {% m
cross_marquee.style.left=marqueewidth+84 n% C& _( H" m# J: y& z, E
& U& ]) {; U# c1 n
}) Y4 y2 j0 U, d" `# h2 o
else if (document.layers){
9 E% s- w5 {+ p, \2 M9 j. A3 uif (ns_marquee.left>(actualwidth*(-1)+8))
" ?4 i/ J, q* M/ N/ ~ns_marquee.left-=copyspeed1 r. N9 R7 H6 {! g2 F# M
else3 W' O. W1 p# o4 v
ns_marquee.left=marqueewidth+8
& o( Z( Y/ L* Q, h& n: K}
7 G1 l8 N: `; P}: g8 J* n% k+ L" l
9 b+ B0 g2 F( q. \. [. M- Y8 h( x
if (iedom||document.layers){! ]9 z& R0 S7 y* e# ?' Z$ Q" p. w( B
with (document){
( G2 ]. \! p2 w+ a9 M8 i' ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 B! U4 Z4 s# Z6 M- F9 Y# Sif (iedom){
( x* v2 F- e- A4 Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): B7 _( r: J. D. Y; V: R/ {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% f' v0 a) b% b! x" l/ @. w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. T* g' O  I, f, `! ?write('</div>')
- E8 Y& K' s# X1 o% P4 O9 S}1 n4 ?% m+ }/ o5 z! ]! n
else if (document.layers){7 I$ W7 m% f/ M* O3 X- ]2 ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ L! J" K) y! A# G/ W- h
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% E6 l8 Z& E% m  D: n# ?$ D! C
write('</ilayer>')$ F, g) ]+ v6 U' Y( z
}9 }) t2 z& K8 L0 R1 v8 P
document.write('</td></table>')
8 y9 L3 l' v5 Z( T$ a  r5 _}
- ^' d) i! p+ m* w}, ?1 M7 q3 p7 Z3 o
</script>

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