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

|
网页之跑马灯文字特效
//修改宽度
) A' ], r5 H- ~0 J( _* Gvar marqueewidth=3007 _0 ?3 z/ e# @4 O5 i, d
//高度
. r2 _; w& r9 m* Q; X" _/ Avar marqueeheight=25! L/ R7 \* E, U" [" ]
//速度(1-10), D: y' C% ]" @, l$ i J
var marqueespeed=3
% F2 ~) b# h4 Z/ U//背景颜色* }# V" u3 v: {5 a5 k) `! k
var marqueebgcolor="#FFFFFF"
5 `$ r- k7 ~2 G/ w. T7 ?, F. T//是否能暂停 (0=no. 1=yes)?
3 U) B* {# i; svar pauseit=1
" q2 V: d6 Z( H0 _
/ a4 q5 Q3 e5 G. O, J- d! N- T//修改显示内容! S: _( |, v9 k4 f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 C. |5 a0 o/ y
# m8 h- N0 O9 H+ H" f8 E" r* g: r3 C h" S4 [! L- h& e
////下面不需改变////////////
5 K% k/ J7 F H1 R7 \; e/ X) s! p- I% U: e7 j9 l3 _* {8 N, A
var copyspeed=marqueespeed
5 a, | O4 ?& ~' lvar pausespeed=(pauseit==0)? copyspeed: 0
+ }2 @* O0 W! c% d- L8 A0 U0 Dvar iedom=document.all||document.getElementById
+ b3 u! i- M6 V/ J% rif (iedom)0 S" N; w+ \4 x7 P+ ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), P+ q" C" J q: n; a2 k
var actualwidth=''
: c3 _/ W4 z+ w! O, F$ t( R% gvar cross_marquee, ns_marquee s0 Q' E2 c" K8 E* `
# c9 W5 N, Z2 r9 Y
function populate(){
( U# g7 i# U) J4 p9 Aif (iedom){+ b1 A" k7 Q9 w" n9 k& Y$ j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ c1 E' d& [6 v7 ?& p" o. D7 e) t
cross_marquee.style.left=marqueewidth+8
& D+ A8 d3 n& ?" ?$ y: U# across_marquee.innerHTML=marqueecontent
& G2 G6 o. J7 M0 x* V; I. hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( x9 p0 T- F! Y g' L3 `8 f* j
}
1 r- F T, ^9 Gelse if (document.layers){' p {1 i# i1 B( Q/ Z
ns_marquee=document.ns_marquee.document.ns_marquee25 t( [0 W5 x# T' i9 r
ns_marquee.left=marqueewidth+8+ W% K0 v' ?9 ]- A
ns_marquee.document.write(marqueecontent)
z# j* u7 F. |" P+ Jns_marquee.document.close()
3 w5 G% z! o5 K7 Y* q$ P$ T: y8 Z1 T: d7 eactualwidth=ns_marquee.document.width
6 [. \! i/ M/ X( d% W}
7 ~2 S# k! u. Z2 c4 O7 jlefttime=setInterval("scrollmarquee()",20)0 b% k/ p' e3 s: T2 F
}+ ]& B- Q4 v9 S ^
window.onload=populate
4 _* ]% W1 t1 }# x2 N1 Q2 J
5 g% J% B, E. z+ o+ J: [7 nfunction scrollmarquee(){
! f# E1 W' G+ w, _if (iedom){$ y+ L j' l4 `! r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 l8 w" `! f) I( X9 y2 _# m" `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 M* k# E. x b( |: M0 selse+ y2 M, r" H& h; U
cross_marquee.style.left=marqueewidth+8& ]4 T0 [' A2 |# R) {
) Y2 |) C9 `" @. i+ Z
}8 |, k% ]- k* O2 @4 ?8 c
else if (document.layers){7 v" n! h" w7 m5 n, d$ O8 h
if (ns_marquee.left>(actualwidth*(-1)+8))
! i9 R9 d7 ^$ E vns_marquee.left-=copyspeed
/ ?5 `; ~9 ]' c, Z6 f7 Aelse+ b$ E+ C8 e, u# k" q# g* O
ns_marquee.left=marqueewidth+8: ` {: K9 J& r
}7 ^3 j- \! T, [& r1 X; V* \$ |1 j
}
/ e( W* w' o+ \9 w$ I) l( a7 @1 O
2 ?0 r7 ?/ @3 @: `( ^6 e/ G% m( Mif (iedom||document.layers){* N+ \7 o! y" q3 Q1 y3 k
with (document){
5 L/ C& C3 k- `" Z) t- A. Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* c+ [/ A9 ?/ n( F8 W! l; K+ b
if (iedom){; b; V ~8 n1 A& ?- g. O7 Q$ k) z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* o( ^ K: H2 I/ t9 F6 X9 J* Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ V+ _' _# H S) Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 M' U! k( D1 d; g6 F; bwrite('</div>')6 m% I; T. U& ]5 Y
}
# G1 G1 N. h. melse if (document.layers){
# X" ~: M& e: w7 u* ~) Iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, L) M4 E) \ { S/ j# J: B7 `4 q$ ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), j6 u& B( C1 Z; k; X
write('</ilayer>')
7 I3 w% b0 F. H}
4 m% e* d8 p6 A. y) j0 H Idocument.write('</td></table>'). ?: M7 p% k( t# r, Y0 {
}! x$ X8 E2 S7 s0 R ]! t
}$ r; [, x u0 B; Y
</script> |
|