返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 e8 o2 r8 }; t# _) H: pvar marqueewidth=300
2 ~# G" X: |+ ^% ]# q  |9 @% c$ Z0 F* O//高度4 o8 y" t" T" q' c3 y
var marqueeheight=25; v# G$ m4 O8 H+ r  _+ r- Y  n
//速度(1-10)
* |; [$ z" Y5 }( X, hvar marqueespeed=3, r  \* i& Z6 U9 }$ a
//背景颜色0 f% Z# h/ i1 o' n6 z: f
var marqueebgcolor="#FFFFFF"+ R0 U# u5 Y; K2 {2 q$ I
//是否能暂停 (0=no. 1=yes)?
/ W" d. ?4 ]; o) o9 A  U8 hvar pauseit=10 u; ~$ P$ o3 z  E
3 C! x8 {+ N7 W6 j
//修改显示内容0 h. n' ]( E3 z4 _) e9 Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 W4 Q, [& U. W+ l" s$ U/ k+ P" L: d6 r3 i
: U9 @7 R# y) v' N2 c( `2 W
////下面不需改变////////////
. S$ a2 x2 }+ e) n3 q4 k% D8 g* F2 k+ E9 V/ S
var copyspeed=marqueespeed
6 a) ?: z* w9 X; ]var pausespeed=(pauseit==0)? copyspeed: 09 _. y" a& ]/ |8 k
var iedom=document.all||document.getElementById, {( Q' v- S3 ]2 ~" @! {
if (iedom): `6 @( v8 L5 p+ W+ l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( x+ W0 \/ e3 _# F2 I) `* e% U
var actualwidth=''
5 A) o' W& F2 B  h2 f4 G" u6 a# o) Avar cross_marquee, ns_marquee+ O3 I  B7 q- {
7 p( `7 ?# t; {& ?
function populate(){
9 u# X  T" z9 u9 E2 jif (iedom){
# F8 o: H" N: F4 Y7 ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) ?8 t+ f5 A( V: l+ g
cross_marquee.style.left=marqueewidth+8! H; |0 E1 s' v  q5 k# O% w1 ~
cross_marquee.innerHTML=marqueecontent
% O4 C- x; `# z% y* Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 Z8 ?6 v9 m3 }( S4 s$ T2 U}
  y6 E  `- c3 Kelse if (document.layers){1 v- F" b% w8 i
ns_marquee=document.ns_marquee.document.ns_marquee2
' ?7 a7 v5 {9 b' c! Lns_marquee.left=marqueewidth+82 T/ X2 b) E' M8 T; h6 _% O
ns_marquee.document.write(marqueecontent)
+ _# N3 N5 ?0 {, yns_marquee.document.close()
4 F* I( \1 L4 F! l  E" f+ Kactualwidth=ns_marquee.document.width& [$ H+ K/ ?! \" L6 b; h* n
}4 |) f% M" k* b0 y
lefttime=setInterval("scrollmarquee()",20)
  o6 ?$ O2 C: C  Z}0 p9 v* @" Q3 M2 `
window.onload=populate
% Q$ [. F9 K, v0 O
+ ^1 H9 S+ R- Sfunction scrollmarquee(){9 i# s: h  C, f" t0 d( d, q
if (iedom){( o! r" L/ I. O% M% |7 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" N4 n$ g$ A. A* @9 ?; F; a7 h8 M* A1 [, Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* Q! r8 y& u+ H7 [* Selse
+ e: P0 C7 |5 ]+ c# l9 I! [cross_marquee.style.left=marqueewidth+87 H" Q3 \$ A! m5 h: Q' o
5 z; O. d7 u8 P8 Q, M' P+ F$ E
}
  c8 K  B# _* A5 ~else if (document.layers){; f6 u" @) C; M6 J9 N, ^9 g, s+ U( }
if (ns_marquee.left>(actualwidth*(-1)+8))) @  G% ^- R8 k
ns_marquee.left-=copyspeed( |8 J6 e+ B! n0 g$ S0 r. L
else2 h) F9 z0 g/ @8 p/ e
ns_marquee.left=marqueewidth+8- |/ {% A* Q. V9 X$ R
}
" \1 a8 r5 M: }0 W$ v- B9 o}
- @' h, x* g7 g; M& U
8 L# X# K5 Z$ o6 y' v$ c2 Hif (iedom||document.layers){3 n& q0 _5 L% c4 m
with (document){
" }4 K+ U* ]3 q' N/ Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 G& {9 l+ f* K( o: Vif (iedom){
& b6 Q8 U4 J5 s% qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 W! z8 C, F# K7 ]: }) R, D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ l; W: z& L% Y8 a8 j9 {8 bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* {; a, u+ K: k! q
write('</div>')
# D; s2 f" g; t0 L& f: \: u, b6 e}$ v- D! O( S: k; y1 ]
else if (document.layers){* ]' C! P% R$ S. A- L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& @. o, S8 O( K1 B4 Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, {0 @# _# c- ], g* ?write('</ilayer>')
$ k& L4 D4 f0 Y}0 I6 ]$ Z6 @) ?6 b5 r& o" ~4 Z
document.write('</td></table>')6 [* F$ E+ {2 e1 f) l" I3 U$ @. W
}
% _$ _( A. u& m# v  O! z- |* ~}0 z4 E3 g; r  t4 L# g; M
</script>

返回列表
【捌玖网络】已经运行: