返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 n8 H$ b/ B* [4 `8 S, H2 d
var marqueewidth=300
- I; Z/ d2 A% M$ ]) a' t# I9 ^//高度: W7 ?) k, l2 ]3 c0 a8 q
var marqueeheight=25
; L; b4 q7 I& y+ J) r//速度(1-10)$ R  v6 W3 N3 p5 w" v
var marqueespeed=3
- X( W9 _* k0 c! r. j//背景颜色
7 u  V2 {3 C9 ~8 Z# Evar marqueebgcolor="#FFFFFF"! B' q# W4 P; q. h. ~6 D
//是否能暂停 (0=no. 1=yes)?" m# q3 C. ~6 H1 U! C
var pauseit=1
' b3 P9 ^3 }, W, a1 N" H+ C; _+ z
//修改显示内容- h$ i5 d8 t" ~' g! S: b, ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ a( E7 ^% K; `/ K& _+ }/ n& H* V
, H* Y4 n0 G$ W" D, p% v/ r
: Y( T- s3 ^/ m, \' S% ]7 W////下面不需改变////////////& t3 f( B) r* u4 v, y4 x) v7 S
8 A1 e% ]$ z+ s  L2 j( D  F
var copyspeed=marqueespeed3 Q( [. g! b# R- u1 y' {
var pausespeed=(pauseit==0)? copyspeed: 0/ y+ r) M5 s5 s7 ~( V
var iedom=document.all||document.getElementById6 l" m; }5 ?; R$ X7 a) k# X5 `3 f3 K
if (iedom)( K6 i* j" I3 W; t. v1 B' \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 t8 `# o4 n, i* u7 E3 l1 Nvar actualwidth=''
( Q2 O" d, }7 i1 Tvar cross_marquee, ns_marquee
7 J+ J8 P5 L% J" S, H
0 r1 H$ q' f8 t5 ufunction populate(){, _$ m0 \+ r" _- b" {
if (iedom){
: U7 W5 O& v" tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: J4 q% ]1 d  F  Q2 \% s' d
cross_marquee.style.left=marqueewidth+8% D7 d/ n" {8 N3 y( d4 }
cross_marquee.innerHTML=marqueecontent
. {. Z0 v0 p8 @$ ~6 b" Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. u' R4 v  ~2 j}4 S9 l& X8 T( W3 p( }# j
else if (document.layers){1 t4 N- g  j. V7 ~, `4 N2 ~; v& W
ns_marquee=document.ns_marquee.document.ns_marquee26 |+ u9 W3 m% r2 U) u0 K
ns_marquee.left=marqueewidth+8
2 h( t8 f; s! b+ {ns_marquee.document.write(marqueecontent)
" f* o5 D( |0 Y4 u9 w( b, E* X- fns_marquee.document.close()
# H; U+ D! k' z& c! x" xactualwidth=ns_marquee.document.width
9 y& Y) p+ L. `1 {% O. Z. O% Y! D. E}1 i" O% B6 F' Z' W
lefttime=setInterval("scrollmarquee()",20)
( j% m, |; ^9 x; |; s9 c}; C  o& |& w6 k. \: T
window.onload=populate
8 n- M9 p% i+ Z+ r- a0 i# d2 M
8 _/ W4 E8 P. ]7 Yfunction scrollmarquee(){
/ e  O0 g' n5 L& w7 P9 Y  H0 \if (iedom){
8 }# {8 n. Q; I* f; Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 Y4 T9 x) b" b- g& d" v9 x; Y( xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. D( R, n4 |' U- J1 M! Q9 \4 Qelse# S' ]  _; q( v2 z
cross_marquee.style.left=marqueewidth+8/ t& _3 c: U/ k

6 P4 {; l& p' O4 B% a9 ~* P7 {}; h- M/ X2 G& U% P
else if (document.layers){1 C$ b/ n, z  |+ \5 j% N0 {$ f) r
if (ns_marquee.left>(actualwidth*(-1)+8))6 r8 E+ S& [, x$ r2 y
ns_marquee.left-=copyspeed
& y( C  d/ p* c+ f3 N, i/ qelse" H& k' z% ^. [
ns_marquee.left=marqueewidth+8$ C& D& X+ I" w* ]2 M  {% h! ^% t
}1 o4 [: N4 ?, i! Q
}0 \; O8 T% [8 e/ _$ \( T  T
8 y5 p( T9 K& F8 u! r  D
if (iedom||document.layers){
# t! q. B' Y2 M) J7 {with (document){0 G3 [/ }5 e. g4 m$ u% A+ v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ X* C' }2 H; t! V4 n0 \; c4 H
if (iedom){
3 H, m2 H. `; k9 H. l; [" ?% J  e9 gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 p  t! H! W3 }
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! v8 H; K1 H+ g- ~& j7 m  B2 mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ m. F( w3 |# [; j8 E, n; b
write('</div>')  y# Z$ C: e/ {' J3 q" Q0 k
}! ]: ~( F& u5 E# b
else if (document.layers){
( z$ d' H+ w  e# R7 Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 P4 Z+ V: s8 l3 h4 k- u2 L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% j( D; Q. w& b# [$ s7 ~6 Mwrite('</ilayer>')* @" c1 x% n, L# c' r" L
}! K6 P7 j) W5 h: r
document.write('</td></table>'), q5 ~% m: A0 O+ Y( u0 v
}" u- b" D$ u2 H8 g+ x0 s
}
* }$ z/ `0 @8 H+ v1 a</script>

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