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

|
网页之跑马灯文字特效
//修改宽度( c5 P9 R! }- d8 P" L( v9 q
var marqueewidth=300
0 C9 D% ~/ e! Y3 O4 D& Y8 v//高度' b/ m% H; v8 A' d, }4 `5 E2 d7 X
var marqueeheight=25; G9 p9 w; `& @" q& @6 b9 c
//速度(1-10)" Z- M8 _; A/ u, B; f8 h
var marqueespeed=3 m5 w# O* n Y1 f+ A# a/ z, T
//背景颜色5 N( |# q( T, T7 Y4 i
var marqueebgcolor="#FFFFFF"
3 _4 R7 w+ X$ v0 `! q5 G7 ^//是否能暂停 (0=no. 1=yes)?7 W$ W' |+ f( E3 @, H
var pauseit=1
/ ]1 Y0 n8 c& b4 U8 V' m( M% @8 p6 n! F
//修改显示内容) M6 s' w0 I$ @1 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" }' E- q* A5 g9 U! O
+ ^# N. ~! F3 {* R: q( f) O
( D { i/ t1 j* A, d% C////下面不需改变////////////
0 N( Q1 J* h$ k" S: c3 Z' @1 w3 q, d% b* V
var copyspeed=marqueespeed
$ N- v; k5 j4 j5 q3 ]1 P- ^; Q" Svar pausespeed=(pauseit==0)? copyspeed: 02 \+ a% ]# q- t& t# l
var iedom=document.all||document.getElementById$ m& ?7 n$ |" b8 ?( ]$ @
if (iedom)" z+ @: g' G1 X. [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! I2 v, l8 M6 U; M4 Qvar actualwidth=''
3 O6 U n6 w/ ~. n/ O$ `2 }, n' fvar cross_marquee, ns_marquee
; b$ z0 P% T% w v. B$ q4 ^4 i8 q! k( s- F
function populate(){
4 i9 \5 c: f. U. G) @if (iedom){! D$ M8 u5 Y' {6 _% ^ u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ Q& v1 U/ @" ^. }/ l2 k5 j% ccross_marquee.style.left=marqueewidth+8
- C* o1 n* y' I1 H* qcross_marquee.innerHTML=marqueecontent% ~, v8 ^2 a8 _# A( e2 ]5 e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( x3 q; a% A0 h& h% V' p4 E% b" _5 f}4 m# J d, n# R
else if (document.layers){
: q) v5 {2 ~* M4 lns_marquee=document.ns_marquee.document.ns_marquee2
7 s" j' G6 [( a# L0 [# l u8 Pns_marquee.left=marqueewidth+8" M0 F5 A4 `, o/ N" a
ns_marquee.document.write(marqueecontent) F! x* w3 I% k" A9 }: f
ns_marquee.document.close()
R% P; c9 k# E" a3 h* cactualwidth=ns_marquee.document.width5 t6 q Q) p- M. @
}5 d' [2 D( @& Q: D7 U
lefttime=setInterval("scrollmarquee()",20)6 H9 u+ Z. l: @4 ]. O, @+ _( {
}) j9 W( j4 C6 C- B, q+ y" ^; r+ s- l
window.onload=populate; Q$ r1 {1 m) T2 R
4 D: c3 T- ^7 ?7 n4 j/ V9 h/ ffunction scrollmarquee(){2 J4 e- h! H4 h
if (iedom){
* ~8 K& G# a0 x) } eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 i6 |$ V% t4 H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# d* X9 t% ?0 Q# r2 }6 I* m7 y; oelse( V' o1 O2 I4 w2 ^5 d, W6 A
cross_marquee.style.left=marqueewidth+8! u- ^: q+ o+ |. H0 q- @+ j
: b/ e/ M7 O3 u4 F
}
1 D$ G! v; `6 \9 b0 ~6 R: _else if (document.layers){, h; M: S/ g2 R( [- q
if (ns_marquee.left>(actualwidth*(-1)+8))& |8 {7 O! S0 i+ m4 l, ?+ H0 W
ns_marquee.left-=copyspeed+ d8 \& ~2 K/ i' Z+ D
else
0 T- O/ m5 _: q, z0 ^6 Cns_marquee.left=marqueewidth+82 i7 C% o3 \. W3 H: @4 Q- {
}
' ~1 }9 v* U8 n2 O- P. D! ^/ e5 n}
. D4 V$ {6 v' L
, s2 M/ l j$ d; u; Xif (iedom||document.layers){ n! r! q7 k; k
with (document){
" `; U" g- o* u7 j3 `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ i& b; g: B1 j1 C4 i! a! |0 K6 w; h
if (iedom){
4 [; @- z* M; Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 j; k6 z6 b8 P2 g+ u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') V; P+ Q: R2 J! A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( A! ?% o- p2 |3 l1 c4 P+ Wwrite('</div>')6 u/ l7 \" F4 R' |: X
}
+ G( ^4 C8 @1 y# Y4 A, [8 Velse if (document.layers){
3 t) G4 x$ d. S+ ^2 ?+ O8 p' dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), w5 H) r- l8 i* A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! z+ S% F' l0 ^) G5 Q
write('</ilayer>')
E+ z# L# H0 G* w3 I8 ?}3 E) j. [. {3 M& S
document.write('</td></table>')
5 N4 c, a8 @. p; u6 A) |% ^: t3 e- H}
1 y+ w2 N: [, t}
4 V3 m, w& I7 o, g, w4 z: P; G</script> |
|