获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 V+ b7 i0 |/ v
var marqueewidth=300
0 L) h$ [+ S3 s- @" @! N/ X' m//高度
7 S6 n0 R+ Y+ \var marqueeheight=25
; h# `, E# l0 A//速度(1-10)
. z7 [1 c/ |4 ], c  W9 I& _var marqueespeed=3
% @6 P! J; i9 U- @: d8 l" O/ u//背景颜色
' q9 m0 s; i, v: o0 D" v2 avar marqueebgcolor="#FFFFFF"; \$ O6 O4 q0 X4 o# h9 R2 Z9 H: m
//是否能暂停 (0=no. 1=yes)?6 {4 Z  k# e% g6 J  ]( X! }
var pauseit=1
  D8 n5 p' G* U) n: U. c
0 }' y  G; W" [8 U3 v7 g//修改显示内容
/ e5 {$ @  }. o( wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ H5 }$ e# _, ^" _9 G; e% B8 E

; X* x  V. \. M  {3 a6 X5 o6 ^% f& D4 Y& [8 x8 _
////下面不需改变////////////6 T1 a9 r3 z7 I+ N

$ a0 Q  d( Z( Z1 ]' `6 j' tvar copyspeed=marqueespeed
+ b1 ?: W' ~6 H! }0 u, s# ~var pausespeed=(pauseit==0)? copyspeed: 0
7 e/ ?5 N, r5 P4 B9 x$ s8 Wvar iedom=document.all||document.getElementById
2 H' U4 y. b  }! C/ v( uif (iedom)
5 F* M7 t  x) l$ y: k7 vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# m/ Z; N8 R! M8 }5 ^6 g+ `* ]
var actualwidth=''
0 ?! O$ k& i% j6 S! c0 Q! x: ovar cross_marquee, ns_marquee. t. m# L4 {# U; r* v. A
9 V* c; G/ Q! Z8 ?
function populate(){
7 B0 ?) U6 P; R+ e' L8 f; zif (iedom){
% M- v% T  W) Z, c; Y+ N+ across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 |. {% a+ ?- T* w
cross_marquee.style.left=marqueewidth+83 k# x: [6 k5 ?/ [6 ^8 j
cross_marquee.innerHTML=marqueecontent
5 ^( f- Q$ w$ T. q" ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ `6 }; w( f( |# l+ h' J3 z
}* u  e# u$ y6 R
else if (document.layers){
( x6 R* b' r- Wns_marquee=document.ns_marquee.document.ns_marquee2) g  ]3 k7 K" e; g' V# F" w
ns_marquee.left=marqueewidth+8
9 G3 x- G4 J" ]/ rns_marquee.document.write(marqueecontent)
* R' e+ w" b  Z6 C2 _ns_marquee.document.close()
9 _+ h; u1 Y/ lactualwidth=ns_marquee.document.width! C0 e# y4 s) {  i8 R# p
}
" n3 m. a: i# j2 Glefttime=setInterval("scrollmarquee()",20)% v$ Q/ a+ c+ b$ d
}! n0 c2 Y4 d$ [/ [8 F5 Q
window.onload=populate
+ w- J  X! p+ d* c5 l2 X3 V4 _* h0 J8 T' r1 k0 P0 r# e
function scrollmarquee(){
: ^7 p  j3 b2 E1 n8 m  R. F- Sif (iedom){7 r0 q2 [. L( h2 Q; a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& Z7 G: `( p5 e6 s/ s* across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ E" z  c1 z7 K  K1 s
else
& k3 E/ u% }" [( p+ F) ecross_marquee.style.left=marqueewidth+8
2 U8 y+ D# c# n& \3 y8 T  v& e4 v' v. x
}& L5 g& l5 x$ m/ d% s7 R# M
else if (document.layers){9 X, k# T4 t; y. c1 B% C
if (ns_marquee.left>(actualwidth*(-1)+8))
: |, Q0 N6 n/ n4 Q( X; j7 f% Rns_marquee.left-=copyspeed
6 x: D+ e- d/ N8 ?( Celse
1 f3 j+ X8 Y- d# S& {  gns_marquee.left=marqueewidth+8
+ s) }% D* C& k9 Z5 h}
0 \& n& O3 Q; A& [}
. E2 ]) ^7 \1 d; T1 |, Z& B
! T" ^3 |/ \# @1 m6 T8 wif (iedom||document.layers){/ l& O5 d5 l5 W7 N1 m8 t2 u
with (document){9 H+ Y" \+ d( d3 ?+ ^( S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 Y% P: N  b  c, A  bif (iedom){; F% ?8 ~* Z3 F* Z! Z3 T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ h7 A' {4 F* c, \# Q( P; ]1 n' Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 J, g* M. U: K+ r. b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. l& {+ m& e; iwrite('</div>')
/ T; I. K  a2 {3 j6 N}
) F, J( }. g9 @. _4 b, F: Y2 U% Felse if (document.layers){( R) {. j! t' b, L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# s9 y( j6 m0 c3 a1 f. Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ G# {  o" M# i6 V3 b
write('</ilayer>')
9 ~7 F" A+ Q2 i% W; b0 H- B}" w0 }5 l' `5 j: S
document.write('</td></table>')
1 @9 W4 k1 \2 f' k8 A# h3 |) u4 S}1 \8 ?/ x6 [3 O9 ^* L3 g; h! X
}
. g# D8 A' D* u+ ^3 h( i0 ^+ T</script>

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