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

|
网页之跑马灯文字特效
//修改宽度$ f$ [( O6 Z. c! U' b
var marqueewidth=300/ P, M6 z' Q w+ s2 a s/ s
//高度! `$ t ~: o. O% n0 \( ^+ I2 n
var marqueeheight=25
5 j# o6 P' h7 b7 j7 r3 Z, s* |//速度(1-10)
" j. d. ^& m+ n8 E* `; Wvar marqueespeed=3
' A6 p. q1 p+ i, i5 R//背景颜色, a( A& a) D5 [
var marqueebgcolor="#FFFFFF"
9 Q8 Y+ b7 a) S//是否能暂停 (0=no. 1=yes)?
+ b! x0 H; l% C( Uvar pauseit=1
& p* e2 @, i; {4 ~1 K8 `' _2 W/ a# D0 }- S
//修改显示内容, ^7 W$ y% C2 J" X3 k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, j, Q* g, g1 g2 D6 F; k+ a- C
. H+ z( Z- N$ ~: f. J+ {. Q* \6 [( b9 o6 X" F
////下面不需改变////////////6 Z6 j3 ?1 H1 i5 N9 [6 N9 \# F3 A
$ X. m% ?, J9 v3 F; hvar copyspeed=marqueespeed
: j+ |2 M' }+ p7 i8 N6 C* evar pausespeed=(pauseit==0)? copyspeed: 0
0 A5 i4 A( o0 P) Y4 ?var iedom=document.all||document.getElementById' j4 D- K0 ~8 w1 r- Q; }' g
if (iedom)
& K4 I9 W8 s$ n+ Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# d( H( X% r2 W" J
var actualwidth=''8 C9 |& P3 d0 B9 k& l% ~ n7 Y4 ]; g
var cross_marquee, ns_marquee
& A# X# [& H0 h, P$ O
/ o4 p8 q7 `& r4 S( Sfunction populate(){% r2 Y, |: ~1 o" C% J4 g" ^
if (iedom){1 s" \& w8 _9 D# C+ F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: m f- P8 D7 r m- K6 a& A: ccross_marquee.style.left=marqueewidth+8
2 y I, M& @5 |8 [6 e5 @3 [cross_marquee.innerHTML=marqueecontent
. |0 k z: d) m, H; Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ L9 i/ u4 E3 M- E% [* F+ x+ ^! @}- M1 N/ ^7 R4 L, [) X
else if (document.layers){+ k9 i+ c5 t: h% H
ns_marquee=document.ns_marquee.document.ns_marquee2
$ e) Q5 J# U( J% ^ns_marquee.left=marqueewidth+8
5 C: k- x( X# Ins_marquee.document.write(marqueecontent)
+ x& P1 g& d) Hns_marquee.document.close()) i: Z$ b# B* m2 b/ {
actualwidth=ns_marquee.document.width. @2 \8 r7 m- i1 C, B5 Z
}/ L0 y$ G9 k$ @: W# T$ x
lefttime=setInterval("scrollmarquee()",20)
; ^; [+ [+ `' F, \" V& M% m6 {2 A}2 d! h# }- d1 P
window.onload=populate! M6 k. H! \, i
9 M; }" Y& E. ifunction scrollmarquee(){$ ~* F) l3 D. B d W
if (iedom){
) Z& c+ O' N1 A, c6 C: m$ Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) j; T' V4 H7 n1 K- _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- `0 I$ D% _( ]( X/ k
else
. t# k( A7 [0 Hcross_marquee.style.left=marqueewidth+8
; O$ d U, y5 X6 [* v2 Q
) r3 t* ?7 @: m9 g}0 p* R9 D0 t3 u2 ^1 E/ i
else if (document.layers){% ~6 V1 ?. B! [+ g% n& U) `- d' G
if (ns_marquee.left>(actualwidth*(-1)+8))7 R! v0 _/ C9 s7 z5 @
ns_marquee.left-=copyspeed7 c& K& M" [; n6 Q
else3 f% x- u1 b# A
ns_marquee.left=marqueewidth+85 H- I# ]' [, ?7 K$ I. d S
}2 {: Y7 ]7 O/ N$ y4 G2 ^
}
7 l3 U; [1 {8 @* K( w+ C0 |3 S% M2 J8 S& |
if (iedom||document.layers){
( g9 ^* D$ q3 K" f2 lwith (document){
2 O# m4 l4 W! Z( ]/ O3 Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ e) V0 g+ \4 X7 _. O6 h# ?
if (iedom){! e* i G9 a/ z3 r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* `; ~) \8 l7 M$ I- `1 |& j# f9 q* Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, d* P& G$ Z* B1 b, i# o* D" \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 G4 D+ e1 ~: ?9 _' [
write('</div>')/ F% n7 P! n8 o. O
}2 O4 Y9 G! k3 i
else if (document.layers){; S- j, R* b4 D- j, T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), \: F# d% j; V. w- Q& @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* f4 _( a( P2 Z) b% ]5 H6 h
write('</ilayer>')
' s# D3 P/ P) {" x. G& W}% z& V2 S2 G. I! D2 M
document.write('</td></table>')6 Q0 a2 M: c7 ?2 g ?
}: w. o9 y$ y* W
}
7 e% Z3 [! ?5 P+ m</script> |
|