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

|
网页之跑马灯文字特效
//修改宽度$ v2 M$ `( S& g/ e! M2 A4 W- h5 t
var marqueewidth=300
# T8 h0 V9 x8 m8 H& N1 b//高度1 ^0 z. t( u* f5 ]/ l0 g: Q) a
var marqueeheight=25 p6 }, `* ?( r
//速度(1-10)
2 M# C9 @( {* f4 Svar marqueespeed=3
- {7 B& T( w3 U) r//背景颜色
) G: q2 N9 \/ O( \0 Gvar marqueebgcolor="#FFFFFF"
# s! k" X. V1 n7 }//是否能暂停 (0=no. 1=yes)?
( e% G8 Y% ]5 p$ f9 I: bvar pauseit=1
; K; q# Z% G4 ^/ D; Y
5 k2 @% q6 T, @8 m' ]# W% q//修改显示内容. P1 @) v1 p' T' W$ _# s1 t6 o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' a% i9 B3 @* D9 v+ y ~$ T% j
8 V0 F9 y/ q1 x5 X& ?
* b% V# B, s" r- K- H) C- y////下面不需改变////////////
) l D* H& ]3 I7 {% |5 u( l9 g/ G9 t% z
var copyspeed=marqueespeed- u5 x8 a) x/ j9 D# K# b( o3 X! y
var pausespeed=(pauseit==0)? copyspeed: 07 g* }7 V. Q6 q
var iedom=document.all||document.getElementById3 B. o" K% k: z5 p; y% ?8 B \) g
if (iedom)7 g. S* I# h2 q6 |& Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), }, L8 B+ u/ x) `6 ?( q8 n/ |
var actualwidth=''3 L( v, ?9 {) j. @0 u1 w6 i) F
var cross_marquee, ns_marquee' W* Q, X# D6 j; B4 r, M( b
5 A' ~* `6 e) V2 Rfunction populate(){2 M! F6 ]. X$ e8 A8 M
if (iedom){
! e% \: K* m: j! p. `cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: o1 I3 @) a+ l. H9 v, q F" ?cross_marquee.style.left=marqueewidth+8% K7 @ g) _2 j4 E3 }& C
cross_marquee.innerHTML=marqueecontent' r/ ?: b0 Q: y2 c8 }/ m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- {# o: f% H2 L9 n/ g}
( ?/ {' D6 L& @' Oelse if (document.layers){
% Y; _8 |. t' l: O4 xns_marquee=document.ns_marquee.document.ns_marquee2
) \. {, e4 L) o* V. n" G. [ns_marquee.left=marqueewidth+82 p$ W6 e: }% F
ns_marquee.document.write(marqueecontent)( P# b e: B, T7 K
ns_marquee.document.close()' Y7 a+ E1 y( T. v0 L N
actualwidth=ns_marquee.document.width7 T. ]+ v* \( p6 _
}
9 k& L- R3 }! y3 Tlefttime=setInterval("scrollmarquee()",20)8 |1 w: Z+ v- C7 e
}) b0 I9 w9 ~$ x$ p1 {
window.onload=populate
# {5 y% e% f' i4 E( T( {: [8 O8 z! H6 }( ~3 `
function scrollmarquee(){! l1 B) A. I2 O. O
if (iedom){
$ W5 t& z: I6 M wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 L+ t9 a1 `1 P3 u! |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 n& X1 B; t7 q9 _2 M5 j4 \8 g4 u
else
: f7 e& ]" B& hcross_marquee.style.left=marqueewidth+82 ]! D0 M- j3 \, ~
* P v0 n- Z* ~) s: o8 d0 u. L}; \6 n* N& ?4 G) A+ B% ]6 A
else if (document.layers){) ]' v, m. {! Y% _) v) L
if (ns_marquee.left>(actualwidth*(-1)+8))
5 p' w4 v. |' t: _- ans_marquee.left-=copyspeed( Y7 w6 m `' j5 ]/ i$ V3 I; }4 N
else
* `; V! W: @+ z& Fns_marquee.left=marqueewidth+8, Y: V7 d9 I; N3 m* \( g
}
5 M; O% Z5 p+ M0 J9 W}
" p7 F6 M7 B( c' f& I* ]# `3 {6 a, A( _1 [9 }
if (iedom||document.layers){
' p' d( f3 S% d% v: M* D: y& ^4 b$ Owith (document){
4 U! n$ Y! u' g) S2 A' L4 U ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& D( a! K, O4 s' ~+ {+ Lif (iedom){
; J) x& e; s+ M# e% z6 F7 ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; C* P9 `8 P$ F3 [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 ?+ m3 E3 b! G& C0 Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ L' D h5 a6 vwrite('</div>')6 E) [1 }- [6 s w
}5 J, w& n: A- B1 ~+ P
else if (document.layers){: F( c# @5 r& x' {3 J8 P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( R3 p0 k! S) o+ a( D+ e0 y4 S5 A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- _! q& n+ o9 ~* awrite('</ilayer>')
/ V+ F5 D. Z% h}
! D! l0 N+ J a& S$ Pdocument.write('</td></table>')
$ s& o/ C6 W Q* e5 g8 G}
, h1 Q2 _7 X: L( V6 l$ y( Z9 u1 j} X4 O. @, e/ S S% P8 P8 [
</script> |
|