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

|
网页之跑马灯文字特效
//修改宽度
0 w3 f4 n5 @) @' I) ?# }* l, dvar marqueewidth=300
7 r% ^ m) }% v" C! o" s/ Y//高度
0 W. P$ P; ?# {8 M* Bvar marqueeheight=25
( c2 C6 i# b# m//速度(1-10)8 I# m+ c D- I5 \: w6 W
var marqueespeed=3' [2 J) }+ |" C$ Z& u* u
//背景颜色
9 `: _% D" r: L: uvar marqueebgcolor="#FFFFFF": q6 x- ~: ]# T5 x2 G% y
//是否能暂停 (0=no. 1=yes)?
& O+ |$ W! D `( I6 G6 S! tvar pauseit=15 w/ J9 A7 u8 ]2 ?
5 U) v" f) B5 O& t2 u. y7 r//修改显示内容2 ~% ~) k5 Z& L) |3 B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, D4 f$ o; _' `
: t) U* p* _( k) ~3 O) I& h% W6 _' e3 r% s. d' `: X
////下面不需改变////////////
5 H$ D# F: d, [. F& i2 p3 E
8 r% \- O) X, f# f% u& }4 q+ Ivar copyspeed=marqueespeed8 S& Z. U# P3 c. U# i5 Y( A
var pausespeed=(pauseit==0)? copyspeed: 0
/ X1 x6 N0 X6 N! d% pvar iedom=document.all||document.getElementById7 w6 x J& Y! K# ]. V9 Z0 O' n8 `
if (iedom)
+ S+ h- n* \5 _& G0 `1 |" jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 S, Y' i4 I- hvar actualwidth=''3 ^( F3 N/ B% t7 ?1 S( }9 ^/ {6 B
var cross_marquee, ns_marquee m1 }! }8 b0 n4 K
8 K$ x% ^! G( @% Y, Q: ]) _3 b
function populate(){$ E5 Q+ J& ?% m6 { A$ O
if (iedom){3 V- U9 f& x1 F3 n7 a' k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" Y! o% \6 ~$ F& k+ J" X
cross_marquee.style.left=marqueewidth+8& C* ^6 T8 W4 g& _" O
cross_marquee.innerHTML=marqueecontent1 B" A: N7 ]/ H! l( g- s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" ~5 J# U4 |8 O( O3 [) M9 k* r# r}6 [9 s: J! i f; b
else if (document.layers){
' o/ S# v5 p7 A1 pns_marquee=document.ns_marquee.document.ns_marquee2
- h. U4 t! l; p# mns_marquee.left=marqueewidth+89 K$ H+ L7 d, t; f
ns_marquee.document.write(marqueecontent)2 T9 d- Z1 r9 r- U. r' w
ns_marquee.document.close()
& W/ U$ y" |: ^6 Dactualwidth=ns_marquee.document.width
+ O3 F6 h! M! Z/ \2 ? E}
1 y6 P# Z) A/ tlefttime=setInterval("scrollmarquee()",20)
/ D3 [. H. J2 j6 Z}
! H; O' C* E# t8 j2 twindow.onload=populate
5 F' E4 m9 B: s( t6 y. H2 [) J" r8 X5 Y3 Y/ L$ N: N- K
function scrollmarquee(){
0 o+ [. @' O+ m/ W4 \! Sif (iedom){) K- \1 U/ q6 V' `" R+ \# z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 C0 \% J8 l3 y) u3 w4 z$ M/ S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% D5 _7 J1 t. ^8 [& O
else8 I! Y$ ^. z3 I$ T! F; [
cross_marquee.style.left=marqueewidth+8- X) a. g. a# l4 a) a7 a
' d" V% d& T( e) t5 j) j8 T$ U
}0 f: t1 c, D# h" S
else if (document.layers){
6 J2 V" u w0 l: j, ~if (ns_marquee.left>(actualwidth*(-1)+8))7 h; b: h* \! C
ns_marquee.left-=copyspeed
9 F7 x0 V+ E( h" W" J* kelse+ k9 e0 ], d- v G
ns_marquee.left=marqueewidth+8: s% S' m P* F- l, u0 f. |
}
( r+ ]4 @, O) M, F n$ f9 E}2 |7 @, X; l6 o0 W
% Q! K* @0 f3 x: w* A
if (iedom||document.layers){
# Y/ W# o1 Z" kwith (document){
& V# O8 q% O ` [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% l; V# p& L2 h2 T' ]6 o, w; z
if (iedom){2 Q( c( x8 X( b, ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! Y" q5 ?* l3 ^5 c; y6 L* ]
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. N, N5 X3 Q3 N% |& G9 Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' U+ R7 Y) ?1 I6 e- l
write('</div>')
8 E- J( P* `8 c9 w6 r}; l9 N3 u3 y! i. |
else if (document.layers){, B$ b1 H2 _/ i& S) a8 _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% N) K& ]5 ~1 Y1 a8 ?6 ?. X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! {: M& a8 [5 e$ bwrite('</ilayer>')
' [0 H, A3 H' }& y3 D/ L7 y}
( ]. F1 A" p' a8 ~( {2 {7 w% fdocument.write('</td></table>')
: d5 y7 T6 f, C. X. w/ K}& f% V# z9 ]2 J0 G* X* i) X9 B
}+ J% f1 V e4 [: [$ V
</script> |
|