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

|
网页之跑马灯文字特效
//修改宽度4 L3 d( c' d" m" v0 F M$ b( V; D
var marqueewidth=300- ^) W& m& R- y: T7 j! |" ?5 T
//高度
, P0 W9 L5 r kvar marqueeheight=25
8 p5 j. @! \# [//速度(1-10)
7 W5 i% d" Y; dvar marqueespeed=3, j/ d& t4 G$ _0 x; `1 K* z3 s
//背景颜色 n$ H. Q% t7 t& g4 G
var marqueebgcolor="#FFFFFF"
7 u! S" L$ I0 h' p* D//是否能暂停 (0=no. 1=yes)?
# T# \1 o: r1 _+ |! Z% Cvar pauseit=1
9 u% _+ ]0 i1 v! v9 |% U8 i8 s) }
* ^: c- T, o5 I% H//修改显示内容
# _' d; F) B5 b9 j X3 Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" K$ u8 L7 l/ R# _3 V( O( X
1 l% T$ p4 X( m( n
* {# n1 _0 ?8 L9 e7 ]7 u
////下面不需改变////////////+ g. C u6 u: h( J# X) z1 `
. @% b! {6 O& y1 F3 zvar copyspeed=marqueespeed3 ?! D# e: C1 \
var pausespeed=(pauseit==0)? copyspeed: 0
& O4 w* t; ^ g% f& _var iedom=document.all||document.getElementById9 t& |) I6 ~+ ], o9 h% d4 t1 C t @
if (iedom)' r. Y& g8 F' s1 _7 N2 {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 T" T+ P8 ~6 g" G5 y" qvar actualwidth=''% q" p/ @ A+ N! }4 N0 u
var cross_marquee, ns_marquee; x. j& j' ~2 N G6 N
( n4 b& K; g/ Qfunction populate(){
/ s( R; K9 S6 v) xif (iedom){- ^8 C9 a& T: n7 b& n: @( k( L- r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 ?& S1 u& e, k. ]# |
cross_marquee.style.left=marqueewidth+8
. [8 N1 K7 {# a+ hcross_marquee.innerHTML=marqueecontent
! M5 R- R# k( ~. r, M* Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 G L% C1 z* i
}$ j8 R. Z6 P% b: [
else if (document.layers){
; L+ B a/ Y( Cns_marquee=document.ns_marquee.document.ns_marquee2
6 P2 x: Q* i6 m: n0 l$ G4 mns_marquee.left=marqueewidth+8
7 B+ U5 m9 t) Z. Kns_marquee.document.write(marqueecontent)% U9 g+ @0 z7 G
ns_marquee.document.close(); h' E2 Z$ U- q8 N( P6 d
actualwidth=ns_marquee.document.width$ f' v& A' i$ J+ S- b0 c
}4 z4 }1 K7 N6 F$ U
lefttime=setInterval("scrollmarquee()",20): ]+ w) F3 J! O$ _
}
3 H" Y8 D7 j4 v0 N0 twindow.onload=populate
4 r3 @ K# V% V( U, l, A$ z9 U. U- F; f5 g, @' @ ~
function scrollmarquee(){
( C* f! t" d* O0 T3 o' Dif (iedom){' m6 o- L- P) h0 T
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 x D& L7 l5 K, W g2 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: M; h6 E6 i4 m' r, H& l5 D0 N
else8 k) F' K0 o' V
cross_marquee.style.left=marqueewidth+82 P% J2 e& m6 y: z
; B, w e0 Q6 g; @}
7 i( s" O0 c9 D2 d5 Felse if (document.layers){/ t1 k: C! K8 L# G( |& K
if (ns_marquee.left>(actualwidth*(-1)+8)), `8 k n% ~ g7 ^; W
ns_marquee.left-=copyspeed+ y) U5 W( I, I: F: M
else& b# X6 ^# k* r3 l9 k5 `
ns_marquee.left=marqueewidth+8: b; u9 W( x. d' r3 F+ i# h) S/ N- d
}, B% a5 H7 t" Z A F5 ?3 E; o
}6 u# _2 W- N7 W: y. E& t5 c
0 }/ }. ~) J+ a: K( `$ i1 hif (iedom||document.layers){4 H% \- m7 y: B" @9 y0 }
with (document){
3 P9 q% V8 _4 P; @2 z/ f- wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 K" g3 b$ [! o; K4 Z9 aif (iedom){5 K0 L# m. P! _" ~2 @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). K0 q" e5 h/ F4 R5 V. P' j( v
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ D* q2 W2 P# i$ \, Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 c# C0 f7 m4 ?9 H( V1 Awrite('</div>')! x& ~# L8 _/ ^$ o! ]
}: \4 u, g2 Q% L" ^# O, a! }
else if (document.layers){
- z6 P+ G! H# q6 p8 t' Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') }* J; g( ]" G+ H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ j+ K3 z7 i) Z2 ^2 A) ]$ _% ywrite('</ilayer>'); L/ s3 X8 i: `" k. f$ ~4 l
}
) Y. W; N3 r5 j0 |1 j zdocument.write('</td></table>')8 A# G7 l( E" |+ J5 _% a+ ^
}3 z8 s9 _; V# a% z ^& l w
}1 [3 I. Y* E- h: h. e
</script> |
|