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

|
网页之跑马灯文字特效
//修改宽度; H4 {) m* x T/ u
var marqueewidth=300
1 B* ?; p' \7 H. F3 V; I//高度' a7 N9 u5 h: J$ x( z+ I9 Z/ O _6 F/ o
var marqueeheight=25
4 _' O- r# k( m. T3 ?4 X) J//速度(1-10). ]. G8 u9 @: L; i
var marqueespeed=3$ ~: D( W8 k1 |
//背景颜色
0 r" k" W4 H# F: N! W* Evar marqueebgcolor="#FFFFFF". Q, h+ H( A& S6 D( m: f7 l. H
//是否能暂停 (0=no. 1=yes)?
5 n8 H' O7 v5 c! B0 ]4 yvar pauseit=1* [# @* f7 N) M5 k- R5 Q' `
( L+ I- W+ y S: N//修改显示内容4 {* v, w* G. i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 o/ L3 l" m Q( {% ?- [! D# `, {
+ T; D4 s4 ^, o8 e/ b* x0 E* k
, e4 G% }. \+ h/ |2 j9 @/ x////下面不需改变////////////
2 j. ~: Z9 G; {8 J" `) m# Z/ U! f, J
var copyspeed=marqueespeed
' e, O" O, W b$ y2 b2 ~var pausespeed=(pauseit==0)? copyspeed: 0: O, A0 [ }9 I; K# ~4 d
var iedom=document.all||document.getElementById; f. f3 I' [0 r5 u Q6 R P
if (iedom)
5 Q8 S2 S7 i# Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. z4 @" b- d$ yvar actualwidth=''5 n8 x% Z4 e' B& ]3 ^
var cross_marquee, ns_marquee6 }* o7 H! T" ?' W
2 w+ ~" K- z. E: Rfunction populate(){
: e) ~ n% z4 \; B9 L0 Y' gif (iedom){) I2 X# j% P3 \3 X6 G$ S. L' c9 i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 O8 Z( D3 w, m7 h; g. Lcross_marquee.style.left=marqueewidth+8
: R* J9 O' m. N* \cross_marquee.innerHTML=marqueecontent0 K% K# E- c4 W+ v1 U8 `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 b: o' c, b8 n$ l- f, h
}
+ q* E8 Y& _& G- S$ Xelse if (document.layers){
* M& k4 Z' o4 I: B' f( S1 _ns_marquee=document.ns_marquee.document.ns_marquee2
7 y- {0 L1 T' T0 s2 Kns_marquee.left=marqueewidth+8! Z% I- g$ L! w* ]) ~* p
ns_marquee.document.write(marqueecontent)
) ]+ Y* ~' A( Y) Hns_marquee.document.close()
& T6 ?3 N) h- b- wactualwidth=ns_marquee.document.width+ \/ r& E( Z" f+ _1 d
}" n& _0 j4 m1 q6 @9 t9 _
lefttime=setInterval("scrollmarquee()",20)
, |' @$ V5 z. s6 L% M# J}
8 n; S7 a" K- w4 E+ V% v bwindow.onload=populate
7 I% o0 d, K* S0 m) ]" C g( @/ W8 }: v
function scrollmarquee(){
- t- W/ P. p$ qif (iedom){* `; z- f& \+ b# I4 {8 m) q5 Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ d6 P9 U4 x: ]! I$ |" [) u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' W+ w: P4 o- [+ X/ ?else! ]* z# r- B" J8 H8 w' A2 C( r* Y
cross_marquee.style.left=marqueewidth+8
8 H0 V" n/ w0 d: n9 |
# ]4 t3 y H! A/ D" r, D! @}
. D- O, d. D4 J0 p- z5 m* ~# R' Nelse if (document.layers){. V7 p- I7 X9 _% `
if (ns_marquee.left>(actualwidth*(-1)+8))
9 P) x# q! Y& k1 Z$ j" ^) [3 cns_marquee.left-=copyspeed) M1 Z) ^+ m5 s3 e1 H; a
else
& m! d d5 m- O! N5 l3 w/ }ns_marquee.left=marqueewidth+8
" x+ d6 P0 W A& i5 {}5 B9 Y/ z' Y2 a4 M3 g
}
/ [ X K O: d# F7 O8 y3 R- h' R9 M% P# H Z
if (iedom||document.layers){6 U3 x) `4 G7 Z- n$ n
with (document){8 a- _( U+ \/ V! {) A6 e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 I% ]* r. k' J2 ?
if (iedom){
# K1 g) Q3 D% e% I+ s. V: K% @9 cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') }" L R: i6 i7 w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 o% V8 e3 H3 O: S; Y# Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( C; z( }3 c- b2 s
write('</div>')
6 y/ b J, {+ ?2 A0 M}* p5 q- G6 T0 G2 s6 \' g
else if (document.layers){$ ~/ g+ Y5 C# a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* g F4 S: I& F0 T, p% {/ x( {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 i- }8 e% t+ ^
write('</ilayer>')
6 `$ ], l+ e2 Q2 Z7 [5 g. L}
3 K7 D: W) w1 @ Y' vdocument.write('</td></table>')3 t2 s, l! J% B" U# `- \# T2 d" l
}. I+ y5 j% Q5 f5 G, X
}' b4 H, ~$ p( l: k) l1 H( [
</script> |
|