返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 w, p) U0 M* u4 V  F# Q
var marqueewidth=300
' O( U, O+ T) _* }) h//高度
0 i6 u6 s: u2 dvar marqueeheight=25- r2 J* M) m5 F! X) ~
//速度(1-10), Q6 L- }/ o1 \! y' S3 M$ H5 z
var marqueespeed=3
# T$ z, |) c1 |: C" i. y3 |8 P//背景颜色
& P0 q8 g! x* P1 q+ G5 G4 o- Rvar marqueebgcolor="#FFFFFF"* }; l! X; q5 u; |
//是否能暂停 (0=no. 1=yes)?
9 p/ l- _) D2 l; u4 Nvar pauseit=1
& s/ c. |' ?1 D4 Z) Z9 c2 Z
: |* B' e3 e& n. ^5 W//修改显示内容
( K; f( P: ]  k) b: tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% R. ^2 G; h1 l9 ~: D2 _! Q# K. Y& e7 x1 X! i% k9 m, X
1 Z; C* F+ y" c( I% w6 D! K4 E
////下面不需改变////////////  z( X) E. U6 Y% |

  ~8 G% i; y/ v# I4 i  `: {var copyspeed=marqueespeed! v, z" d/ J$ l! Y* i7 D6 o" f
var pausespeed=(pauseit==0)? copyspeed: 0
: N0 i8 S- C0 E) s+ J/ ~var iedom=document.all||document.getElementById
3 A, T8 h, ]: V/ ^9 hif (iedom)
& |" n% f  h) H. e/ ]. G+ cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. ]) j) D( w' g8 G2 J3 Mvar actualwidth=''
; @- |0 u3 M5 a( q+ Q2 F9 tvar cross_marquee, ns_marquee5 s' W( I5 Z$ ^- t+ \, H
" Z0 |# w  k1 f$ @! _% I
function populate(){9 ^4 K; w' R8 p4 l5 C" @3 }
if (iedom){9 n" N7 j" w6 i& K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) B7 ~9 W' }4 v& p, q; W
cross_marquee.style.left=marqueewidth+8
& n& m& C( \( F- C% P: Mcross_marquee.innerHTML=marqueecontent7 s% k9 ^: f& B" X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& B9 f! d% e# N2 K* [- L}
) W/ r4 c/ f- x: P3 M: ^/ Q( a; I, Belse if (document.layers){
9 X0 _! s# Z) i) B) ^" O% @, lns_marquee=document.ns_marquee.document.ns_marquee2# M9 B0 D2 r6 Y$ U/ c% L7 t& R# Q
ns_marquee.left=marqueewidth+8( C% v( |( d5 Z* v
ns_marquee.document.write(marqueecontent)8 _: g# J* l9 E" _* |5 B: w4 r8 G
ns_marquee.document.close()
6 |2 g1 u5 i2 N2 @actualwidth=ns_marquee.document.width
& A; ?4 e" g; V! w" ~  w/ _}6 i& j7 Q# _, g  M
lefttime=setInterval("scrollmarquee()",20)
: x/ _- j% \/ M! w2 i}
) R% ?& v. Y; D/ Ewindow.onload=populate5 C1 A/ A4 x/ e" s

5 r* G3 O. z; D/ dfunction scrollmarquee(){
! m1 d2 g; I* Kif (iedom){* [8 j$ n6 G- b
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 S: n5 O, e) H" @# u" e* across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  c3 n0 t; r- f
else
- W/ L- @( B! Z' g2 ?& |cross_marquee.style.left=marqueewidth+8$ N8 p$ Z' F5 n! \

( |/ r$ {, j: u+ r}
. _7 E" B8 _0 Velse if (document.layers){
3 s0 {" r+ o+ _" z/ ^; W, O/ Hif (ns_marquee.left>(actualwidth*(-1)+8))$ c% R: P: [! Z# l0 c. D* `6 W
ns_marquee.left-=copyspeed( @; ~9 q. A# C! C
else3 a) @7 `3 B4 ?
ns_marquee.left=marqueewidth+8/ j  @% d- I' w* l* K! r# a0 k
}; l# f/ K. F* A) B
}
8 ?4 G0 N. ]' E8 H$ x% I" Y" p' ^+ \8 F1 A
if (iedom||document.layers){
' T* O4 C$ E1 d% zwith (document){
# T) B0 t5 {* O0 _/ o! Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 A# O/ f3 a3 D) n7 |
if (iedom){
# y) O3 R; f2 n# v$ kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- u$ o* M. U# P! x# S; _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( k4 P2 [! A, M. S  ]. C2 c: n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 n% R* J+ h6 n7 @
write('</div>')  [) J/ Y3 z' S; U9 L) B3 {' h
}
  G3 w& @( k) S- W, k! F! W, }else if (document.layers){
  r+ ~  p2 }8 K  z- s% iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" X% i+ z' u! V+ Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& P8 ~5 D1 V5 ^* i/ ^+ H1 y& ]
write('</ilayer>')
* _; }8 ?9 \; Q4 T/ \}
, I4 z8 y( o, ~: u- W% M* H; Cdocument.write('</td></table>')
1 t2 r+ z- c- H2 [! s4 B}' M8 ]  T, u9 g; M
}) r, j$ T5 n  @/ s" h( }
</script>

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