返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 ?, ~* k! x, e) P+ Evar marqueewidth=3008 e! }' O2 ]+ i6 y% v9 |
//高度
2 Q' A/ B3 g+ T2 @* Ovar marqueeheight=25
# G  a1 S" `# j) N//速度(1-10)
. Q0 v/ R1 u; i# P9 avar marqueespeed=3. A( s5 x# A: H8 R/ n8 f
//背景颜色
9 ?: _- }6 N5 ~( ?2 Zvar marqueebgcolor="#FFFFFF"
0 p, T: A8 O* j( N# i4 u4 \" r//是否能暂停 (0=no. 1=yes)?  ]- a. p: W* ?- C! D6 F7 j
var pauseit=1
/ A  r4 i; _- B  V0 d! a3 T* C
5 z2 \) h8 F$ ~% F2 M! _//修改显示内容
: _% ]* N6 W5 R" {  [' [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 W8 n% u! Z( C( {

7 s: x) J/ {3 T7 M+ Z; ~. T' G, M' g- l: D: g: h' v+ Z" {* ?! H
////下面不需改变////////////2 u6 D' j: N# J; Y7 h6 w0 E1 X

" G$ _3 i. G8 Cvar copyspeed=marqueespeed1 f! n9 \+ ?6 w8 r' S
var pausespeed=(pauseit==0)? copyspeed: 0
. t: q# I* e+ C/ V/ F; cvar iedom=document.all||document.getElementById
" O! {1 P5 w  j' R. D% [8 P$ ]if (iedom)
' t' w- V, ~+ [8 S4 Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" j6 ~: z7 A: ], C. n
var actualwidth=''% d- I3 ?5 f9 r6 ^/ o) m* C  b' Y& o
var cross_marquee, ns_marquee
4 `- O/ c1 E2 V- n+ c- c. K8 h; B0 a+ p, g. h1 A, s( @
function populate(){. V; Y& Z, G. h3 X' c6 d, ~( @. r
if (iedom){- s+ t* z$ ^4 ~5 o' O! Q& f, C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; ]* ~- b/ U, O0 v; w: X/ C
cross_marquee.style.left=marqueewidth+88 e$ A4 I* ]$ l: h6 T2 m
cross_marquee.innerHTML=marqueecontent
3 e0 e7 C/ k" b) Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) J  w9 Z; C2 z" M, G
}
! T& L$ B. z  e( helse if (document.layers){
3 Q" t+ ~" E0 r  Y' f7 i9 u+ tns_marquee=document.ns_marquee.document.ns_marquee2  }" s) j' F  |* M. s
ns_marquee.left=marqueewidth+8
" ~7 ^$ P1 p( ^" J6 b. z  r3 [ns_marquee.document.write(marqueecontent)0 r$ o5 f8 I7 i" D- R
ns_marquee.document.close()3 T$ Z8 \$ [3 a. v3 R; t9 Z9 b
actualwidth=ns_marquee.document.width
1 W0 @5 [1 v" |; i! |4 ~% Z, ^7 K}$ `0 [2 R* p& t  n7 ^
lefttime=setInterval("scrollmarquee()",20)
* q- l) {. o( m' l+ }" i0 E}. Z3 W! J0 i4 |6 Z* V  y# x
window.onload=populate! h8 f  l" ?9 W: X" O8 Z

5 A7 n- s; Y8 S5 J4 Cfunction scrollmarquee(){1 T" x4 |$ X- \3 \  N) G" Y0 E+ J
if (iedom){- N( {3 ], B. U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) i' ?: c/ F4 G6 l5 N4 ]5 r4 N# b2 a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  R+ W9 h$ u( Z
else
' \  v6 B7 c6 M' w; f0 zcross_marquee.style.left=marqueewidth+86 F, P2 z- C9 I0 ^5 t* h
4 s/ P) }/ m: ^) d
}5 U! P1 n, x. X  G0 Z
else if (document.layers){
& a2 I' @9 X+ z& Dif (ns_marquee.left>(actualwidth*(-1)+8))
1 }6 T) p# t8 e9 Gns_marquee.left-=copyspeed
( l. ~9 u: O& o! ~else! Q; ?" i+ S- P- s
ns_marquee.left=marqueewidth+8- F5 p% U5 G% X& ~
}: I7 o* s# \9 d, x& p1 I
}  T0 X2 F% J) ~; F9 k. y6 O

5 x: t8 t% \+ }" }if (iedom||document.layers){
  }. N7 m; b# ?  K( E9 j2 I; ~" {with (document){
" y: j+ w& G$ B0 e' C3 [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); g& E+ A; W  K; h8 a2 k
if (iedom){
( G5 p+ M: H3 P4 R; B  W1 l3 p, K, wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 ^6 v/ M8 B4 k( J0 c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% K8 `' f( Q6 }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ {0 b" L6 ]; c: D% fwrite('</div>')
; C5 S' Z0 a  k- r! w4 y6 R4 \}
& D; x5 D/ A4 o3 c! F# A' kelse if (document.layers){
( n% G" ^* Y2 _! K+ Iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 n& b( ?9 R& F; |) f. y% ~& cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! {% d4 I; I" B% i& {write('</ilayer>')
9 b5 S+ z5 p+ M) m- ~+ b}
0 p! b" h6 D' R7 L4 i6 |4 `7 rdocument.write('</td></table>')- Y0 L- ^% J/ A5 s; @0 N
}' G. x2 {: L" a3 \8 {( E
}
" A- B8 Q. _7 `( q- _$ W4 b</script>

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