返回列表 发帖

网页之跑马灯文字特效

//修改宽度, _+ N; W2 D: l. s& o( [. n
var marqueewidth=300; h+ X4 y9 d" d, x; ?
//高度+ v8 g1 y4 H* P. i8 z( C
var marqueeheight=25: o% `4 B0 x+ ]0 Y
//速度(1-10); U2 h2 D4 k2 V0 {. ?$ Y
var marqueespeed=3
) b( ?# M6 a) g! J# @  r+ W/ v) G: J) O//背景颜色+ }6 D4 c6 J& x' s
var marqueebgcolor="#FFFFFF"
$ s( c# |: x5 N. C- s) m0 h//是否能暂停 (0=no. 1=yes)?
9 D1 u5 r9 R5 L. K  f# Uvar pauseit=1
2 K% y% y1 R; U/ n/ t+ S2 F2 P5 z4 q5 \- e: L
//修改显示内容
& Y, {. H/ k/ q3 @+ L. G+ u& _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 ?, g( ~- [3 i" o0 A* b+ S3 L- V5 M" b7 F/ |, Y0 Y

8 v! C2 t: y7 y( U7 ?////下面不需改变////////////
- r+ Y$ I- a4 X( r% Z( g; k4 y. e) M- {3 O0 r
var copyspeed=marqueespeed9 X4 H6 \7 |% S. K- w
var pausespeed=(pauseit==0)? copyspeed: 0
' C# @: F' G2 hvar iedom=document.all||document.getElementById
# {. g# ^0 p6 U# L+ A3 L6 ]if (iedom)% b5 _% J) E# Q! l& W/ F/ |2 H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 H" T4 @! l, ?( G6 F
var actualwidth=''( J8 G8 g$ x2 |1 H) r0 Z- {
var cross_marquee, ns_marquee4 c" P) |! B/ F6 C+ L2 M

3 z( D) k( j$ h! s+ Jfunction populate(){
& E- ~& k8 ?) V: M7 V! ?; W# i) qif (iedom){
% f' L3 [" x" c, |, pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ S2 D: ?* `( S# @
cross_marquee.style.left=marqueewidth+8
( P( f0 k" S0 D4 ^, o1 z3 Scross_marquee.innerHTML=marqueecontent, ]; C/ q; S+ R$ K+ a5 M) G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( H5 l2 y! w) F1 v2 ]5 j1 |}+ Z9 g+ t* A* K* a3 a9 B
else if (document.layers){) ~. i5 k# _  ?7 m* m& e
ns_marquee=document.ns_marquee.document.ns_marquee2
3 Q* W$ k8 y0 Q- m2 V9 Qns_marquee.left=marqueewidth+8
) Z4 h, g' x% }! I3 K5 Zns_marquee.document.write(marqueecontent)2 C, }$ k0 V3 M0 w
ns_marquee.document.close()# W9 x, Y7 I9 K+ U( x
actualwidth=ns_marquee.document.width
# d  X5 a4 ?! c4 j}& X$ o9 j" `& W: }
lefttime=setInterval("scrollmarquee()",20)
7 ?$ P1 j) S4 z& f/ H}' f- v; O" {5 c: p8 c7 j8 N/ y8 I
window.onload=populate
; o& x: O2 w4 G/ y3 M: w. `) L- C+ I. h
function scrollmarquee(){8 m  N/ G. F2 A- D8 ]3 n. |9 d0 d
if (iedom){/ z7 l  y3 I) K" g% R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" @+ G8 b- ?" O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; D9 A4 P3 v- Q+ b# _
else7 ^) j3 ?* x4 {; v) R! N
cross_marquee.style.left=marqueewidth+86 H) g+ K  O9 k% n% ~9 f8 v+ ?
! Z* M: S+ V+ Y$ F3 d
}( m% G( k  m8 X. t0 A3 ^. O' _7 |
else if (document.layers){. m) _) S# i; J# T1 y
if (ns_marquee.left>(actualwidth*(-1)+8))
& E2 w# q% w5 a1 {4 w0 Bns_marquee.left-=copyspeed
  [6 o2 d5 L( G  u/ jelse
. P7 Q  y1 n; Q! c: v" Sns_marquee.left=marqueewidth+8% h8 s# W6 q7 f6 b5 T5 m; b
}
5 c6 |" h0 f; q; |; i2 O}/ G. q7 C* {# S0 @* M

6 Q( b  C3 s  ]; @6 s- aif (iedom||document.layers){" Y% N( V0 N! d$ }
with (document){6 [# N% I$ E8 }2 B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); G- @2 v5 P# C
if (iedom){
, Q. e5 Q4 @9 Q2 l- \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); U8 I' J1 {+ Z* i) S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 t1 m' R- f( X- n* C. w* iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ c. k1 c$ O; u; _, A0 ]
write('</div>'); w. f6 {% `; K' Z' Q0 [5 P
}0 g* U* i+ i$ a3 X" P* s
else if (document.layers){) @5 N: ~0 U* @/ Z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) u8 I7 C& E: x7 p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' P! c: g5 Q' U6 j. C7 p* V$ N
write('</ilayer>')- ^5 }2 N% S6 f  _6 L7 X/ p1 i; P) A
}3 j1 ^0 Z0 }2 b" Q% X, y- ]
document.write('</td></table>')
4 ?  r) B- O8 e2 G1 s2 h6 @}" O7 Y* u9 _* t/ _
}: U6 K, C8 Y: e0 L2 \& j0 e. ~" J
</script>

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