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

|
网页之跑马灯文字特效
//修改宽度
( O7 N0 i3 m0 X2 P: _var marqueewidth=3002 q( ]7 b @: D# H( ^
//高度8 z0 G$ w2 n+ _9 d! f/ G4 d
var marqueeheight=252 J* L& w$ d% ]; O
//速度(1-10)
; F3 y( i5 j# ^9 vvar marqueespeed=3
0 a6 O+ ~1 R; V3 n9 v' s% i* F( U* y0 {//背景颜色2 I! f% J& J2 b k# _
var marqueebgcolor="#FFFFFF") J) {: u9 o9 M6 ]" k
//是否能暂停 (0=no. 1=yes)?
' {4 d, C5 ? J. f9 V- y1 |var pauseit=1" @! g! k- Z0 F, Y/ i9 A% \+ s
6 R( q u( @6 A- \: L
//修改显示内容4 |$ z+ I8 r4 m( f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 A ?2 u; N1 C0 |5 e& z
; p, k" D$ P' E& c/ o5 `. a5 q' t% L4 B0 L* L1 k, @
////下面不需改变////////////
% O, }& L. L2 d+ P8 S: E
) v" y& I; f# M: A8 G' h) _( Y& mvar copyspeed=marqueespeed. G1 m- `) ~: o" p' l% O
var pausespeed=(pauseit==0)? copyspeed: 09 ~/ C) d. I# j4 n
var iedom=document.all||document.getElementById
- M8 P& l6 z6 m+ f" i, L! B3 oif (iedom)' l) G; T/ r, U) ^% Z. [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 X( A6 @2 a7 |- }0 dvar actualwidth=''
2 \1 V6 t9 W! M! d/ I `var cross_marquee, ns_marquee
7 I* ]! N6 W6 N; m: Y" B1 o* T. ^0 _) a; s( J2 X4 b O
function populate(){
3 O1 o3 U6 L0 v0 K6 kif (iedom){6 k) T- T) e$ `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" y; M' V- g3 S6 j# u j2 f4 B
cross_marquee.style.left=marqueewidth+8
' X! z1 [& K# A( K4 i8 E3 qcross_marquee.innerHTML=marqueecontent
C: w) }: L! N& _* Y" Q, Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 I, _/ U" K0 s& p% t$ Q}3 @, o. @3 m9 `, t# L) Z. x
else if (document.layers){3 S7 d* [" }. h b
ns_marquee=document.ns_marquee.document.ns_marquee2- {9 @# G. c) x- ?0 L, u. K
ns_marquee.left=marqueewidth+8 _8 p' ^. b7 G4 B. T9 n) s9 E
ns_marquee.document.write(marqueecontent)
+ V) v# q \1 ~* |" ?( D8 Q! H7 |1 sns_marquee.document.close()
9 {2 }4 i- L* q) p; d" ?actualwidth=ns_marquee.document.width7 T5 }: |( p5 {7 N U y
}
3 Y0 _8 S, o: d( E# n" ]6 ylefttime=setInterval("scrollmarquee()",20)
) K7 h7 e! F0 Y! u9 m, g: t# r}$ }: w! L; R3 S4 v1 f8 {+ F
window.onload=populate9 m% ]9 r( Y% J& `
2 w' s4 O7 K& j; ^& d7 Lfunction scrollmarquee(){
8 q3 G; ?% V: K* c( a$ T2 tif (iedom){6 u7 B9 W. |; f' d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" h4 v: g' U! k- K( V3 Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 |, y; {7 i& Lelse; X) s4 i3 i' b" f! B
cross_marquee.style.left=marqueewidth+8
. Q8 m# ^7 Q: L& C, x& ?7 h& y5 k1 [: C5 Q v- P/ j" N
}- m9 A' e. B- W1 D- F( J( l& v8 }
else if (document.layers){7 M; {) l, K6 |! W5 H) j7 Q* o
if (ns_marquee.left>(actualwidth*(-1)+8))) L; x% @( g. V6 F7 I) v- F
ns_marquee.left-=copyspeed
4 m' i) ~8 @4 welse
5 b6 T3 R# X b0 [4 U1 y* Z! o- ]* Zns_marquee.left=marqueewidth+8
0 Y, @8 Y/ x' I6 ]) @+ k}
# @& x* B. i9 ~ E}
5 D: @% S% {% p0 Q- j2 J# X) L( Y5 S2 r3 I2 ^
if (iedom||document.layers){
0 i" T! h2 y. K2 t |# ^' fwith (document){2 c( d8 ~$ S6 f: @7 C0 c3 z- E) h
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 g1 C5 T, H0 s! J5 _& n" _! Jif (iedom){
; y+ {5 v3 C( u6 o# Q9 O* Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' Y L5 _8 B' t5 m- T+ D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! m: t- V$ p5 d( ?; B$ y, Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 l+ j& r/ x: i7 ?: U$ |" S
write('</div>'), E! M' D9 w0 W5 y
}8 M, n, g, {% `% `- `* R
else if (document.layers){
) e5 \) A, g; owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: M( z1 \1 k/ O5 J6 F& Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& c: E8 D: N% U. a; iwrite('</ilayer>')
9 _+ X+ p. \3 u6 a}
+ N2 a M+ Q, i) Hdocument.write('</td></table>')* E' \8 ^+ A' w1 }
}
$ i- I9 f( r2 X. q0 \# }7 A$ o}' I( e4 J) C- a) |" q
</script> |
|