|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
# ? y& P/ h! Gvar marqueewidth=300( a7 R4 U/ `( x
//高度* u* y9 c" X( r& B" a( z
var marqueeheight=25
7 t6 m* w5 U9 _& U//速度(1-10): |% Y) g. S& E4 T% v
var marqueespeed=3) Q. q2 m$ Q+ b: X+ b0 D! t; h: e
//背景颜色3 j' M. R9 q6 y
var marqueebgcolor="#FFFFFF"! p7 v/ Q3 T" s H
//是否能暂停 (0=no. 1=yes)?
7 Y# a" ?, v0 h) `0 J: t# Evar pauseit=1. Y* S$ z6 s3 I: h. U9 f
6 p# j4 v7 `6 x9 N//修改显示内容
) m8 X- N! K, v2 _/ Y1 V4 Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ M3 b% B1 k( ~+ R9 V. \' ^& u- @2 G/ D. x
" W0 x" a8 ^0 l# E7 G# u- v5 Q5 R////下面不需改变////////////
) ]) g8 m9 Y% s- R7 m/ B. D# ^2 Q" z4 z" O& D% B7 H1 g3 ?$ S9 E5 H
var copyspeed=marqueespeed
7 S" R" i& G* P( ?2 @var pausespeed=(pauseit==0)? copyspeed: 0
$ Y8 u# D3 Q0 V; ~- B uvar iedom=document.all||document.getElementById" N* f7 G; l0 Z8 w
if (iedom)
2 H7 t( m3 F6 f, Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 p2 c0 c+ _1 w2 A3 Kvar actualwidth='' g- Q' k& W1 ]
var cross_marquee, ns_marquee4 R; Y( L \" ]! Z
6 a2 h8 U# r o/ Nfunction populate(){9 u: y7 l: Z. i3 B
if (iedom){% F( d( M/ W4 X! A4 o/ d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 ?+ ]! Z8 D) f( R) Fcross_marquee.style.left=marqueewidth+8
5 g N( N2 Y% n# C* jcross_marquee.innerHTML=marqueecontent' l7 S2 w! ~# E$ T9 y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! j" _% c: a% c2 u( w) V
}
1 V9 B2 @: o5 l) U; B3 G1 Q; \4 f8 Velse if (document.layers){0 }, d6 e! S9 W8 s* J! e
ns_marquee=document.ns_marquee.document.ns_marquee2
% H" b/ {- z- ?" q* ?( |ns_marquee.left=marqueewidth+8
% C8 r, y% j8 w! I3 y1 Bns_marquee.document.write(marqueecontent)( N9 q& b( ~+ Q
ns_marquee.document.close()& b) u- Q% D. g; r+ ~& g, H. f
actualwidth=ns_marquee.document.width
, h, V/ ~& E1 D2 t) i J- P2 j# C7 j}
. u' c* H+ U1 a8 Dlefttime=setInterval("scrollmarquee()",20)! N# D. c: N, y
}6 `9 `$ h# p4 X( T
window.onload=populate. W9 ?1 [+ U& ?" }+ F
8 k3 p2 L. g# N) |3 D( {/ P
function scrollmarquee(){( l* n( o+ q2 U3 e+ ~- k( T' v
if (iedom){
" p- ~6 q/ i n, w6 Q _1 i& p0 mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* a+ [2 i2 X) u: N. S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: G, p {2 E$ ^$ H& ]; \, gelse W- H! Z6 S8 L4 \+ B
cross_marquee.style.left=marqueewidth+8+ `; e6 Y, V) Y+ k1 v4 T- k7 N6 u
+ A. t9 K' z" { ?* U, v8 e& o5 O( ^
}
7 N6 ?. s# l: T: Gelse if (document.layers){
$ N3 L- ^( c3 B# a/ V& w* @if (ns_marquee.left>(actualwidth*(-1)+8))
6 C+ ^0 ~& S+ ^+ j% J; ~4 Xns_marquee.left-=copyspeed
) @, R6 L' {* celse2 a! x- p1 Y$ P& V
ns_marquee.left=marqueewidth+8
) Y0 P, D2 K8 o2 \1 `}
) b& T' n* @% J$ M6 ?/ v}
' i9 ~( ]/ a1 S+ m4 o" U7 c+ s" n8 m" J
if (iedom||document.layers){
' Y* @: s& a0 Nwith (document){' j: y. l2 Z+ a! \+ H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 b5 g8 Q! ^" u: v3 iif (iedom){, g7 t6 O, T( Z" I% c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% Z3 a/ r. N: _$ M. a( J8 Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), R4 i) j5 I9 Y( l/ B0 R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 x: y% A y9 V5 b( H; l( @" Owrite('</div>')' Q! e+ A. e4 ~
}
0 h. ^9 x- @4 c \else if (document.layers){8 r# V* r3 |4 I L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ }. q D! H: T3 r0 gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 z* l7 f6 e# J& w) J& S# Cwrite('</ilayer>')
) @0 Q; t/ B& {' o3 r- G, |}0 I5 h9 P7 h7 G/ B B: P
document.write('</td></table>')
; p, Q6 ~% _' ^; ^% V2 F5 O7 V9 Q; j" K}
' }5 \0 Y1 }5 S: M: }; c3 Y}% U: B/ W9 c7 M# _
</script> |
|