返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ L; J- N9 j+ j% L( p8 A$ }6 }
var marqueewidth=3005 r/ h6 V, w/ r
//高度- G; l  x( |) l8 ^" [# `
var marqueeheight=25
3 x8 a; ^0 S! B9 v% H//速度(1-10)( D$ g7 ]0 Y6 N' G+ {
var marqueespeed=32 c( w! H0 t: `
//背景颜色
) s+ u, |  _" i* S2 G3 n$ Mvar marqueebgcolor="#FFFFFF"
( J3 U6 F) B) C! V) v1 d2 I4 A//是否能暂停 (0=no. 1=yes)?" _/ T, C" h; S! c5 Q! Z
var pauseit=1
2 B# N# A* }0 J7 Q+ [( J% j- e  G) z1 R+ K
//修改显示内容3 u' ^* L) g8 R7 P/ r" M+ X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 Z4 t2 ^; |9 a) n- I! x
& [1 R9 d- m" z3 O0 P

: v$ P/ z! K) G+ k1 L$ C////下面不需改变////////////! |2 P, r* ~' `0 J. ]1 v6 P
* m: I, `7 j5 y7 K; [' D. k4 g
var copyspeed=marqueespeed8 h! K+ g8 U$ b* P4 j/ X/ x
var pausespeed=(pauseit==0)? copyspeed: 0( a, L/ n$ U8 r  M
var iedom=document.all||document.getElementById* W1 e+ u0 w0 F% f
if (iedom), A3 ]8 v- H+ P2 H; \; N3 W0 J% q7 w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- ]* K3 j: g  I' Y- V( T5 j' ]; F7 O
var actualwidth=''* g* l6 I* q0 q% P
var cross_marquee, ns_marquee* B7 D1 x. u6 Y  `: R/ E3 Z* L! o

7 o9 h+ c- ?" p* e5 S* Efunction populate(){' o  H7 L4 s' S
if (iedom){# f/ h3 f) E( b1 E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ c* ^3 Q! r. |8 J6 C( ?) zcross_marquee.style.left=marqueewidth+8
9 O' i9 l' }" {& H% ]( ^cross_marquee.innerHTML=marqueecontent2 h; ^  O, R2 S, k0 b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- @5 [7 P; N, T1 r}
& ?5 p4 q! A$ Helse if (document.layers){+ {2 y1 x" s* O. Y# D7 I
ns_marquee=document.ns_marquee.document.ns_marquee27 R& k1 I3 ]$ L, ~4 `" \; V
ns_marquee.left=marqueewidth+8: F5 x# m5 I, u; p
ns_marquee.document.write(marqueecontent)" y" C, ~3 B  N
ns_marquee.document.close()
* A# W. M. t8 I! f' `. u8 Cactualwidth=ns_marquee.document.width
& i3 q0 ]# X. ]* @) R2 o4 q. S}
7 M& X4 v/ `4 ~& p6 d7 llefttime=setInterval("scrollmarquee()",20)0 n4 v, S" ~$ o
}
' {$ w0 e! J3 o% V5 l% i7 uwindow.onload=populate, T! m; O. F' c5 U- U  ^
) b$ G+ O/ Q( L- j3 m4 H1 }
function scrollmarquee(){  v8 P$ X. g8 L0 |7 N$ w
if (iedom){3 X( g  W2 S  z. q; N$ u% ?6 [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 y0 {8 a( R& ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 w2 y  J9 U/ K) V# k' L& g1 b0 I
else; g% a: V% b% X' B9 o* _: q
cross_marquee.style.left=marqueewidth+8% N5 K3 I" \5 m5 _  l. G
. q5 Y! H( I8 M3 a! T& G: M
}/ o+ N# D! }2 \2 V: ]" l& {
else if (document.layers){! z# D9 V, u% q: q; R& M
if (ns_marquee.left>(actualwidth*(-1)+8))# F# A9 P0 h( [' R% Z9 r, `1 B
ns_marquee.left-=copyspeed
. U6 N' j1 t) B' M/ `# q+ ?else
4 Z" q7 e8 Q5 U% c& Hns_marquee.left=marqueewidth+8% b+ X- e) E; W, ?& l- u# z" j
}' e! H6 M9 W4 u0 d1 C" X( A1 m! Z" W
}
. m4 Q& M) {# b0 I( @: L% x, L& m8 [. U( t+ }
if (iedom||document.layers){0 a8 F+ Y. g6 T" `
with (document){
& _1 l1 i" T' B6 Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); E' O9 m. A( I5 n; G
if (iedom){( P- g4 x& A# g3 f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 R) @+ H! \" Q, e! a% c2 ]- Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- |1 E/ r: F9 j' k8 g; ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ L; P) C( E6 s. r# Vwrite('</div>')
- ]! g/ `* L! M$ I}2 l+ Y" H# s% y3 H
else if (document.layers){
$ ]3 s6 |- `. ^- {- U6 pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ x' H& y* P0 R/ [$ K. p# G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ i- k  G, x5 t; b' F% z& e; {
write('</ilayer>'), b! A( M7 y( S5 U& _5 ?0 L, F
}- X) }0 t, t2 u
document.write('</td></table>')3 T" W* y7 ?& R7 F/ T5 k  Q
}
4 V! |( f/ H$ t0 T2 n}. m5 P+ A, U# k
</script>

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