返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 P4 |# G. U. g/ ~# Z- |
var marqueewidth=300
( W0 x6 J' G/ x9 y$ W//高度* y0 W# N8 v; A2 @0 o% P
var marqueeheight=25
6 H# l# e& t  ?7 A9 G  E& n& v8 u4 d% c//速度(1-10)
& O2 K4 z, Y& k2 u- t7 Fvar marqueespeed=3
) Z5 \+ ~6 m% O! Q9 X//背景颜色
" |' |! ^* S: O! b& Kvar marqueebgcolor="#FFFFFF"/ `2 h2 G1 q" k6 y7 Y1 p! A3 W
//是否能暂停 (0=no. 1=yes)?
5 X8 i% z7 W, N% i% x# gvar pauseit=1
0 k" B+ }! K* P8 X/ x
8 x8 B- f; [* m2 q9 Q2 f' F  }5 h//修改显示内容7 M8 S/ C" T; i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 [+ {8 w1 I2 Y6 e2 J2 N; d

' d: q5 p$ |+ {: @1 E1 O) b+ U* ~# ~; A, d
////下面不需改变////////////
3 U" a+ |4 {1 V( v6 T1 m" h# e/ Y$ ~9 b! T; Q8 u% ?
var copyspeed=marqueespeed
5 y% J4 ?) s/ A. R) E9 I* D6 k' H1 Pvar pausespeed=(pauseit==0)? copyspeed: 0+ j1 n; T% v- D+ R
var iedom=document.all||document.getElementById
( E3 g& g4 J' u* }: u7 y, h9 q6 ^if (iedom)2 R( @2 c. Y- y2 P3 U1 x3 t% z/ F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. `5 Z5 m: [, C* V0 I4 I6 Gvar actualwidth=''. n* D5 O) ^4 F) O) U* h# Q
var cross_marquee, ns_marquee
- [5 ~6 {$ N3 m2 ^
. m- c; B* x' `6 {" jfunction populate(){# D3 l: X7 N" o8 K
if (iedom){
+ X' u1 A% Z0 p0 V# Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, `; v6 o& o9 Q2 u; |8 l6 g
cross_marquee.style.left=marqueewidth+8
; O4 d8 i* i; {" Icross_marquee.innerHTML=marqueecontent
) R8 D4 g- P0 u1 P* H* Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ A3 b. T" [, M& \4 Y
}
+ s  Q: k2 Y# F; d7 Nelse if (document.layers){* t3 `: K+ \2 C2 X/ a
ns_marquee=document.ns_marquee.document.ns_marquee2
. Q9 V/ k. O$ w) _/ I( Tns_marquee.left=marqueewidth+8
  j. X( l  V9 p' n; h9 b% X8 m2 i4 ]ns_marquee.document.write(marqueecontent)- [( T* ?2 J5 e
ns_marquee.document.close(): m, Q% p& S- C" j
actualwidth=ns_marquee.document.width
) R% z0 J- r2 r, A/ q}( G% ]$ B) r1 s; X$ x0 [' l
lefttime=setInterval("scrollmarquee()",20)# f# C! B* f* f
}
+ M5 H# A. |+ B* b( B8 |1 c5 Awindow.onload=populate) A( W4 P3 g  M" ?8 P; R

: s6 S. U" H5 W8 u* T( Vfunction scrollmarquee(){
  G% L' u0 C8 ?( }* jif (iedom){2 [, J) u! o4 V2 S5 q) C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ H/ D0 J7 F; c+ i0 r; |' Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! V0 H- H' L; Oelse! C' F' h4 X& a: ^3 ]) R
cross_marquee.style.left=marqueewidth+8
% D& q$ `! l4 b) |! L5 O
; w& m. U5 D6 F; f* j5 W}
! Q  z* q# q1 Y4 welse if (document.layers){
$ ]6 ~: i8 L. P$ v* Oif (ns_marquee.left>(actualwidth*(-1)+8))
- \; `. }# p8 @# Y9 m& o$ J: F) Xns_marquee.left-=copyspeed
. A+ i, v, J& ?! Gelse1 c7 l+ x. H* m9 l- I. w
ns_marquee.left=marqueewidth+88 Y1 W% u' r: @5 Y+ d# J# g
}/ [; t7 I% r4 ~5 h9 N
}) a- ^. `- H& ]

; m: s% C+ \" T" dif (iedom||document.layers){
( `  u; h3 r7 C4 U4 swith (document){& U9 g, ]" O1 S2 i- ^* }" f4 [  z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* h7 z. v2 g$ f+ K
if (iedom){
/ V& q4 e3 o3 Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ u; B2 g1 a6 K: [: z& E- u* Awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; i% A8 T) M0 _9 [' bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 S: C1 K! t% A& d. J
write('</div>')4 P, F# ~; R2 ]1 D2 t
}) N( J; s! a7 D+ H
else if (document.layers){! A) Q# [& `# p9 t
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" Z, j  ~. y0 R6 Q$ l; o$ [6 M1 M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ C8 W0 i8 n# u+ K$ X* g6 |write('</ilayer>')
1 F2 E$ m1 a" z- [}
' A; p* m3 X* {1 }' Ndocument.write('</td></table>')
+ T& a0 {" i9 W, M; O4 ~+ t; q* ~}
+ f. m" R, d- A- _}' U  U8 h1 c3 [; e1 X/ C* ~
</script>

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