返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 C8 R( h1 O  v/ y) N+ z+ E; e8 N
var marqueewidth=300
9 x9 I) t/ H+ J5 F. ]& C1 |//高度
9 E+ }6 N/ z. o" t1 p; o' S6 ]  Ivar marqueeheight=25
% l3 I4 O( A" G6 w//速度(1-10)
6 C( j" l. a5 l1 A1 Y  lvar marqueespeed=3
4 t; g  i) C! a& ~8 f//背景颜色3 H4 l2 C$ `/ K7 r  A* a1 V
var marqueebgcolor="#FFFFFF"
. x7 F/ B$ X1 U4 M: Z/ N# d//是否能暂停 (0=no. 1=yes)?
' v1 k# _! n$ t, Bvar pauseit=1) o" O+ J5 q% ^5 j
1 T9 Q. t7 x  N' [% K
//修改显示内容
% F; B& i8 Q7 T9 @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': M0 k3 `/ W1 D: u& _: C6 k$ o

; H, H0 a  D/ a0 m) {$ _1 I, ^" Q$ @" r( Y6 C& w2 R; g, a3 [3 i
////下面不需改变////////////9 v2 a% D, O, p4 m  X6 X

7 g: L* d: |) ^var copyspeed=marqueespeed# |6 O0 }- F8 m% X6 L0 g
var pausespeed=(pauseit==0)? copyspeed: 0. q% D8 x  i, U5 j
var iedom=document.all||document.getElementById! X/ k0 J3 n' J2 l
if (iedom), F0 |$ x6 t" J" g5 U" E8 F( f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" |  B% A9 W& V9 E# S' C
var actualwidth=''% i( h! K/ w6 r
var cross_marquee, ns_marquee9 e9 g5 g, p+ `! c3 E
# J* V1 M2 _. C$ m2 ]3 u0 H" m
function populate(){" ^  `6 R8 o3 U4 |
if (iedom){
- x+ f% U" j, C. l9 d4 G* G" `: Z; ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- {8 l9 [, d. l" z
cross_marquee.style.left=marqueewidth+8! T. j+ c* {2 W( q. j6 m2 `
cross_marquee.innerHTML=marqueecontent
( s  N( z4 B8 @8 N  r' w. Y( l4 g9 `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 r+ b2 t3 ?2 ^& I6 ^' x
}# [4 G, B1 n2 N* L2 e
else if (document.layers){1 x3 u5 P& s' L
ns_marquee=document.ns_marquee.document.ns_marquee2
3 s$ c$ U- a5 B4 Y0 Yns_marquee.left=marqueewidth+8$ s1 {( m( K! r% C9 L' ?8 d' X* S, @9 L
ns_marquee.document.write(marqueecontent)
1 C5 e# J  ~0 j2 ]. U7 bns_marquee.document.close()* d* T$ e) N* Q+ _5 z
actualwidth=ns_marquee.document.width
7 B3 j. f5 J9 u7 m}
' h; T# c7 u. U3 Ilefttime=setInterval("scrollmarquee()",20)0 ~2 n  C6 A/ ^
}
# m' Y( A' X/ y9 z3 V# U8 dwindow.onload=populate* j' i$ l5 f4 ]1 z: F# S

, Q7 E6 i* K  @% P- ^/ z2 _2 b5 P2 jfunction scrollmarquee(){+ Z7 R' P4 |; Y( m, z
if (iedom){9 x7 a4 R' h6 Q8 v  J6 _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' f2 @  g6 r! [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 q- ]' K- T4 T: \# N1 Delse6 l, `  j1 [( i$ }9 n2 `1 v; m
cross_marquee.style.left=marqueewidth+8
% l" N+ |! m! {3 ]  M* v$ F- k% e
}' A5 R5 w$ G% i) h0 U% j6 ?  X
else if (document.layers){. J- o7 N: k. u) @5 |% B
if (ns_marquee.left>(actualwidth*(-1)+8))0 w) n7 s! e- K% V5 |9 l0 k. p
ns_marquee.left-=copyspeed  r* g1 ]* h! a
else; u/ I- P2 c) n  J. g
ns_marquee.left=marqueewidth+8
6 a1 o/ S3 \- ~' L" l9 E}
& S6 I1 R# E) E}
; j' t4 b8 l) P+ e) E; c/ U  j5 A/ u6 d* A
if (iedom||document.layers){
) o: g& s, ?& g  Cwith (document){2 ~0 ?! |9 y4 ^- D9 X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# E5 U, {% a4 ~2 O3 O) n
if (iedom){$ Y+ J0 O6 R' T& [& f8 E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 G: @: p0 O  n  Z, c/ K/ y5 i2 Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( Y8 h3 W4 f) T6 t' U. ]! r& m1 ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& p- e4 w: H9 A' Cwrite('</div>')
; D1 \. Q2 b) \7 O8 ?1 x}
3 x; ^/ {0 Y5 _else if (document.layers){
7 J! I; E0 L8 ]. f3 m: G  d: l+ Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" L3 V  k2 \  j5 w0 ?* Y- ^$ a9 k' |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' ], }' Q7 U2 _8 u( t: {) }- Cwrite('</ilayer>')* X) k; e& t/ q; ?( l2 \
}
! C) [6 ~8 t" Zdocument.write('</td></table>')$ Q7 y4 {: Z- ^
}) J+ p9 C5 r4 S2 r% t4 T2 }: Q5 O
}
, T/ Q) y% P& \5 P7 l</script>

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