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

|
网页之跑马灯文字特效
//修改宽度( H7 O4 w' P/ L: H# N, }4 |
var marqueewidth=300
) R$ E q: n; W; ?. H% G6 v//高度5 Y; L' c( y+ n1 w- j, o
var marqueeheight=25
' K- \5 }$ G$ B& W3 M6 u3 H//速度(1-10)
3 S5 ?: b: f: ?; V2 {' s5 f& z% \var marqueespeed=3! C4 `( b* A# z; D) d0 p9 q# Y
//背景颜色. |3 G* B2 f7 q' Y' ]
var marqueebgcolor="#FFFFFF"* G+ \# f$ }5 [# Z# l) s9 B
//是否能暂停 (0=no. 1=yes)?' C4 Q. I/ d6 M6 I9 A' E/ I# o
var pauseit=1# X8 Q! `, |) g) J! Q
. P1 V3 _* T# ^; N& n' B; s8 U* j//修改显示内容
0 c2 N. j6 G+ y. ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 I9 y. @& Y" u" f1 Z0 [. o' { k
& L/ r8 c& H7 u2 F* A9 r
////下面不需改变////////////- w4 b2 m( r2 I5 E; B
. i2 D8 T+ O4 t8 g% @var copyspeed=marqueespeed8 n- m3 u" C9 O: l
var pausespeed=(pauseit==0)? copyspeed: 0" L) r( t( {& ~! a y. x
var iedom=document.all||document.getElementById
- g+ G. _3 b. G; o3 J% hif (iedom)
, L$ U; V+ X$ L- t; `' }, N# K4 Q% ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 w2 a9 _" W6 I' H- W- F2 \
var actualwidth=''& d& w& c, n/ j3 E/ }
var cross_marquee, ns_marquee( U3 h* u" a& ^9 ?/ _% B/ O
3 \7 f% V* m: Z$ ]. _function populate(){4 o5 P( Q2 `( D( ^
if (iedom){
" o# x$ b$ X+ b6 ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ |0 V" E& K% \2 q% ~; a6 B Xcross_marquee.style.left=marqueewidth+89 f+ W& R) o- W z% `) v
cross_marquee.innerHTML=marqueecontent: b Z7 O: P9 H, Q: I6 r8 B# ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 L+ L9 n2 H0 V# d2 u" _}
' G+ q) f/ E1 R( r4 K- Y5 Lelse if (document.layers){
0 v4 x1 A% v- i$ ]ns_marquee=document.ns_marquee.document.ns_marquee2' U* s6 A# F- j
ns_marquee.left=marqueewidth+82 u1 {- P5 s# m( }
ns_marquee.document.write(marqueecontent)& M2 \2 x) V- @/ j
ns_marquee.document.close()7 o; P! o* X- s/ e! C
actualwidth=ns_marquee.document.width
/ H S1 A$ I9 h2 L" c/ m; ?}
4 T2 V5 W8 W4 ?" k! @, T( g5 wlefttime=setInterval("scrollmarquee()",20)6 } O: }* n# G6 B' [+ s6 P
}
8 X" P8 c( c* G( a V; Wwindow.onload=populate
+ r+ Z" Q+ g/ E8 S0 }$ L( E3 ]* b% {3 _9 ?: `5 ?/ f% z: g+ Y
function scrollmarquee(){, z3 Q1 e& C1 J" p7 ~
if (iedom){
- B& V+ }, N9 `) F: W1 m0 y6 X9 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. }" k2 X+ j5 e2 }1 R( Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 M# P" v! z8 ^! r1 b' h# A; a- zelse
% B1 k- q, U0 x, `4 Hcross_marquee.style.left=marqueewidth+8) Y3 s& ]4 r! [$ S$ {
- @/ m, }0 C- u$ Y) p% U3 H7 m6 U: t
}
7 P' _$ G) |/ [& N- O3 T7 pelse if (document.layers){7 J& x' `4 U' ]' f9 _
if (ns_marquee.left>(actualwidth*(-1)+8))
3 c" r+ u" {' ^; {ns_marquee.left-=copyspeed" w8 ]+ U/ k `0 d) H$ f
else/ M z- k+ ?! p8 B% R; x. Y; d
ns_marquee.left=marqueewidth+8, h6 v- x+ c% N
}4 g! Y% {1 v. E3 }
}* d q4 x6 ]5 F3 b
, {$ V c8 Q" U) r& K" G$ Pif (iedom||document.layers){: F( x; m+ H% \7 b( a" M
with (document){9 J* e* L& @! r1 c! w7 F% C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 Q. c8 A; ?, r1 u7 |8 k* Z% qif (iedom){
5 ]& \+ T9 D/ Q3 twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: `' q! H1 Q6 M7 `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! o X0 A+ S- Z. L4 g* m
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 y. }" i! h9 j/ H9 Y+ |
write('</div>')- r I" \* E$ T
}" x" o+ L; h+ I" ~2 A. B
else if (document.layers){
; o: D% M' c# Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- ], B4 h9 L* ]! R' i! xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) `8 J/ S; K9 T" p
write('</ilayer>')( F: T# R% a7 ? e
}7 @8 l/ r+ N+ F6 C9 E) U
document.write('</td></table>')7 r9 X- Y r% B: I. f( ~; Q
}4 O$ @7 a( l' w: n8 |2 u1 B0 ~- Q
}
! i0 W% V" ]" I! t# R& r C* O% q% q</script> |
|