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

|
网页之跑马灯文字特效
//修改宽度
& {' k( K2 W7 S: j5 L% ?var marqueewidth=300
* X2 ?; q+ N& ^/ P* D1 y//高度
5 |; w* i- C3 Ivar marqueeheight=25
% e8 F/ w2 H+ `1 O5 c//速度(1-10)
: r1 N8 W% [' u3 nvar marqueespeed=37 |; L. `" W" b# w+ X6 X" z
//背景颜色
2 x! I, y3 u1 V, _# C( n( Xvar marqueebgcolor="#FFFFFF"
% p1 c0 B: @7 U0 V$ F* `//是否能暂停 (0=no. 1=yes)?2 Q2 c( A# @! W" o
var pauseit=1
- \$ s+ i* E% z. r5 K- _5 v" B# x& i# U/ j( f- d% t
//修改显示内容
, c! A7 O, e. A5 {7 ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ w. J0 Z5 T6 c; q5 Q
: y6 W. f# V& h9 |7 Z7 f# L0 z) c' y7 x4 H7 U* D
////下面不需改变////////////6 {; h( d; h6 O+ P( h$ F+ M' D
6 ?9 B6 u* p* ]1 m. p: ~
var copyspeed=marqueespeed0 l5 X W2 L4 n l6 n
var pausespeed=(pauseit==0)? copyspeed: 0
: a4 f9 I) ^8 E$ j, Jvar iedom=document.all||document.getElementById
# J1 B; H9 e1 M$ wif (iedom)* Q {/ g6 O( J4 \/ G, o+ h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! i/ ~, w- N, F5 g) z! V& n
var actualwidth='': ]# V( o2 q# Y$ }- o/ H. O
var cross_marquee, ns_marquee" `/ F. W9 o6 a# X) I! s
- _0 |6 o8 x9 p1 v) e$ x& a1 c
function populate(){$ r2 t+ \9 i3 h( {% ?5 m- v
if (iedom){
) p9 a. W$ U: J& icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# U4 C( y$ x) g+ t5 L) Z2 q
cross_marquee.style.left=marqueewidth+8; A: P7 e ^3 I2 X, F5 L
cross_marquee.innerHTML=marqueecontent
6 d7 G& @8 o0 F* W) iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 {) X( f9 K3 j# o- D. ~7 O}2 ]/ Z* k) q" j; v0 C G( b( {
else if (document.layers){/ V7 Z' a1 L7 p
ns_marquee=document.ns_marquee.document.ns_marquee2& f/ A& m6 }( B4 B
ns_marquee.left=marqueewidth+87 C& `0 t& I: B) v$ @2 S
ns_marquee.document.write(marqueecontent)$ K' M& |# {* A+ N! Y
ns_marquee.document.close()7 w6 w7 P; N; l' i/ }) }5 N1 j
actualwidth=ns_marquee.document.width A! I) Z8 A' Z+ f* I
}0 K. C' G. u" Q, ?' F+ c; |: u
lefttime=setInterval("scrollmarquee()",20)
" Q2 ]5 Q- j2 w w( F5 q, N}
5 ~& u" U! E- ~0 L1 l4 L( awindow.onload=populate
) V* A5 U0 z3 |4 R
- k2 L6 @ U& O( m! V/ e6 @function scrollmarquee(){% v% G2 M1 o4 |- Z4 O5 B
if (iedom){# L4 \6 ]8 n& Z' [7 ?$ G! R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 h# a4 c1 [6 [" A o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 [7 n6 h* Y3 N2 relse. i8 N6 E5 J2 X! ~
cross_marquee.style.left=marqueewidth+8
" D5 e8 h( H$ [7 L5 h4 [
7 U U2 k9 I+ J3 R}
9 x- | o% U1 U& K8 Yelse if (document.layers){
: ~2 z1 P/ W7 z! O) M, Pif (ns_marquee.left>(actualwidth*(-1)+8))
' x9 v: f' o1 U7 \+ Yns_marquee.left-=copyspeed
/ Y- b1 E7 ^8 V4 Xelse
5 K7 y4 t9 ]& R/ Y# @, mns_marquee.left=marqueewidth+8
" j, T1 P& d8 M}
+ e# M J' C& Q6 \- v6 o. h}
: H& d, y& n$ K7 ~' x+ T( r
, W+ q7 B3 X5 ^ aif (iedom||document.layers){# R+ I( z7 d H
with (document){% a; G5 l: S0 E, f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ r+ V& d9 F0 ]. p+ b1 |3 eif (iedom){4 I$ ^' b2 m& u8 M3 m# ^- Z, w3 M, s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 `* \5 o X/ ]% c* d. Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( v% Z5 M! z% g$ Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 c- E7 }, u4 c% @7 C! [& R0 r6 W
write('</div>')
: B0 d3 }4 ?4 d% @5 F+ E}
g" N ]" G8 welse if (document.layers){ Q7 Q( |: z" L9 H' g* K, i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' [6 l! S9 p7 `8 i( Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: l! A' ^& e4 {( S, F4 x' T8 ~6 Iwrite('</ilayer>')' L2 {: P3 Y$ R6 R# y! x+ ]' O
}. |, k+ r6 S- R, v9 N7 y
document.write('</td></table>')- F) F0 E6 b$ ?3 n
}$ o; q: z% V! M4 w
}
- K. F3 o8 f" N" |8 ^. O# P</script> |
|