返回列表 发帖

网页之跑马灯文字特效

//修改宽度: `( G% j& ]$ d6 y) R5 o
var marqueewidth=300
5 n" C" e% d$ A6 x' h# A! n; p. u//高度- ]; G/ e( a/ l/ C/ W
var marqueeheight=25
$ \1 C! \# x" T' H$ q) d//速度(1-10)9 U6 I" C$ S; u9 J! w
var marqueespeed=3
8 H! _8 E: V  c  z//背景颜色7 b; Z: z: `9 ~0 |
var marqueebgcolor="#FFFFFF"
+ y) S. e7 t* J" X2 i7 D) k+ a) `//是否能暂停 (0=no. 1=yes)?5 R( g# b, H" R& t+ K& t$ ?
var pauseit=1
8 Y' Z+ ^/ x% _- q& \
; u# u+ b( W- O1 T2 @3 E3 X  y//修改显示内容* `' m6 E& Z; U) \/ z& T# Z& U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* M. V" A# C, T& R) `3 B5 B" @* L7 k3 T" R

! q! E/ y  ?3 P9 x( }0 P, e////下面不需改变////////////) l; ]& E$ N; C! z4 t* l/ R

* P/ p7 n3 i! t2 N6 l) b9 Fvar copyspeed=marqueespeed
2 W  j0 t3 E5 L$ avar pausespeed=(pauseit==0)? copyspeed: 0( L6 T, G$ Y& f" }$ }6 Q
var iedom=document.all||document.getElementById
1 J3 E6 M$ D% R  P" G9 `. Y' Tif (iedom)
5 D1 ?1 L6 t. M) }: o' |& ?1 wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 [8 h3 n. u2 a
var actualwidth=''8 ^2 G) |; h  a, k9 n- J) j0 i
var cross_marquee, ns_marquee
) K' n$ i1 c( J6 b
: z" B# B# d7 k* Hfunction populate(){& |3 ~! r3 a( L8 n6 h
if (iedom){  i& r8 C1 x  K1 b( B( _' E) Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% K) l2 \9 E7 {; ~4 s' L
cross_marquee.style.left=marqueewidth+8
7 Y) J( h2 B' v2 T, s) Z" Ccross_marquee.innerHTML=marqueecontent
8 Z- J! Z7 z% ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 o( E  y) Q6 k8 l6 H9 G7 k}
* L+ ]# i7 J5 Jelse if (document.layers){4 E4 R7 T5 V4 x' h$ L0 v  l# ?
ns_marquee=document.ns_marquee.document.ns_marquee21 \: B( G% \  i
ns_marquee.left=marqueewidth+8
5 X0 a& T  ]8 x; o5 X* [2 gns_marquee.document.write(marqueecontent)+ x- F; e8 B3 J8 O9 N% }
ns_marquee.document.close()
' J. C/ c2 j3 I  iactualwidth=ns_marquee.document.width
( R+ l4 R/ Z- V( ~+ Z# [6 V4 y# G$ ?}
; u  c  V; i3 {lefttime=setInterval("scrollmarquee()",20)1 z7 j# k7 e+ B' [
}( k8 U& J8 W, g* L$ H
window.onload=populate9 d( I) e4 q3 |6 V7 V( n
2 ]8 G; @( G) K# m8 @* [( }1 ^
function scrollmarquee(){
, Y# [6 H( [" ]5 Z# oif (iedom){
+ k1 f% b7 K9 P$ |, u# oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 G( {+ f3 x" C& U6 B+ W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ f" t  B1 E7 {2 q1 oelse
+ M+ z, e* n- E; Z6 Wcross_marquee.style.left=marqueewidth+8" T5 G! e- Z9 w) H  w- g3 ^
* W9 Q0 P2 \) b
}2 N1 c, R+ b1 x4 ]6 W7 X
else if (document.layers){; u, H" d7 j/ o4 B: q
if (ns_marquee.left>(actualwidth*(-1)+8))
: K8 g, V; d2 C! r  j- ~ns_marquee.left-=copyspeed3 ?2 \  S* Z0 F
else- P( d) G3 [% K4 M# s5 `
ns_marquee.left=marqueewidth+8
6 o' Q) U3 {) z& h}
& W5 d9 M& _' N( x( R}3 o( X, o0 Y* f, ]
/ j& `/ f) L/ W9 k$ M6 U
if (iedom||document.layers){! l* K' Q' H& |
with (document){
- C) C% W2 q9 [7 j" Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) B7 S' N/ X/ i+ A% r) X% v; Aif (iedom){
4 a. Q- i( B  ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 u6 d3 s+ y3 A; A" t8 Y$ x- q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ j  W0 {+ O- m/ M1 z3 qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), w' W3 X5 o" w% ^6 M3 D; S
write('</div>')8 P# Q/ E% R/ a+ x/ f1 j4 J2 P# F# c
}7 U9 w! ?% U8 r  ~3 S
else if (document.layers){
( M# ?* l. d$ ]8 X# ^0 Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 P4 y4 \7 L7 W/ ^! F6 n. Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: A- @+ p/ B8 ~# c3 C- Owrite('</ilayer>')
5 `5 F0 f6 F& ]) C) a6 V}
( l1 H2 @* _9 k% ?7 l6 Xdocument.write('</td></table>')) o. i/ r7 T1 r, p; ]
}
6 P) G0 v: E" H- ~0 ~}
+ b! G1 Y) d: G- H3 i8 m. Z# r</script>

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