返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 U% }5 r+ x* h$ U$ Q$ V
var marqueewidth=300
" |: G$ D( l: T, S, @! G//高度4 ~9 {5 T- f$ ?7 o3 H2 S
var marqueeheight=250 I* B5 P7 T: n: g# @' L) R+ P* t" Y
//速度(1-10)
1 y# Z! W! X, r- }# q, nvar marqueespeed=30 p/ a! i' g# `4 g! M
//背景颜色/ o& p: u0 h# v1 A6 m( s
var marqueebgcolor="#FFFFFF"
; i* K+ u8 _1 s9 i//是否能暂停 (0=no. 1=yes)?- P6 R8 j% {3 l1 [2 @; _5 {
var pauseit=1
8 h: t9 [5 h8 U# K9 L1 ?- i* M7 r
0 E$ {2 y: z+ q9 q, Y//修改显示内容
3 `( e1 y# b' Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" N+ j- d9 @6 @* t; y
! Y) h, ~/ W6 q6 n, y! _8 W1 `# V3 W; R: M0 c
////下面不需改变////////////
! Z) }$ O2 X) N, x& P) g1 i$ C7 X5 }: q, z; K4 @4 ^
var copyspeed=marqueespeed
. x- R4 b) {% o3 w9 Ovar pausespeed=(pauseit==0)? copyspeed: 0
9 W6 k+ d$ _6 [& M5 ^" xvar iedom=document.all||document.getElementById. D/ C. j) P: ~& z4 J6 ^- Q
if (iedom)
, P0 `5 Z% c* V5 R% edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 q- Z) k9 g/ F. ?var actualwidth=''5 U; u, S2 w2 Y& i4 |
var cross_marquee, ns_marquee" u% x9 L) f' Y% d; a& ^; a* o+ |3 ~

/ }, W6 y9 G+ J' tfunction populate(){
( s4 B* W4 z/ H6 S2 c% ~, O  {if (iedom){- x/ p2 h$ H+ o+ T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 _" j5 B9 s& X& P6 v
cross_marquee.style.left=marqueewidth+8& f+ |9 a- Q7 z
cross_marquee.innerHTML=marqueecontent
- r  x9 W/ q9 p: o# a, m4 o" Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 g' T" l) b1 E! y$ y$ T; u& q}- W/ @8 a! D( l% V  O3 b
else if (document.layers){- L! Y" l% i3 r7 [% c& V2 ^
ns_marquee=document.ns_marquee.document.ns_marquee2* }( c7 H( P4 [" t. r" ]
ns_marquee.left=marqueewidth+8
$ J( U4 L: S$ B( g/ t8 n4 ens_marquee.document.write(marqueecontent)
* Y9 Y1 h8 W; l! j7 U, f/ v5 jns_marquee.document.close()
1 b0 l+ ^3 P8 f/ Q% X# G; mactualwidth=ns_marquee.document.width
' H+ `+ b! ]8 S7 w+ o" x) a}
  n9 h" f+ F9 o, Dlefttime=setInterval("scrollmarquee()",20). |: u9 g' p0 ]1 Z9 {- ]
}8 t6 `$ C; Z) S  p4 W3 N3 Q
window.onload=populate- V! B+ t4 M) i: f' u" o2 @

! y" N* w. ^' C) m$ u9 A" vfunction scrollmarquee(){$ H: F  j; \1 j$ B: v
if (iedom){
9 v! r% L7 ~* F  rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- i3 ~. H  W3 k( {/ L, p+ H1 fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 x/ O/ Q% ~0 g( |else
1 R+ h' y; R% f* l$ S1 ^" P3 ]cross_marquee.style.left=marqueewidth+8$ |3 y; M" S+ p' H

& B, s1 I2 X5 I9 r}
' ]$ d! M; L9 Oelse if (document.layers){2 t- o7 X( K3 B1 ~) N( Y1 d/ D6 |
if (ns_marquee.left>(actualwidth*(-1)+8))+ g8 A3 m) o0 ^/ o( k
ns_marquee.left-=copyspeed$ G: U- }/ q2 j  z/ U
else# }& i, ~  p: C8 i0 B& M; h$ m
ns_marquee.left=marqueewidth+8
1 n0 C5 a8 g+ N}
1 z& x4 J9 C6 u8 d, P}& w2 X4 S1 X( x+ {- p

1 X( J+ H1 |, Q- }& wif (iedom||document.layers){2 ]+ a+ d/ X# H% M' ~
with (document){
( D. I) c8 t/ ]7 u* Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 E; \" h. M$ I0 Q7 r% F1 {if (iedom){# W/ r* ]2 O% m9 z; f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ P4 h* z' _$ B) W$ M7 P8 R5 y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- w! S" B; \1 u- B9 S! L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) O8 C3 r$ ?# E" t! y6 ~3 Bwrite('</div>')
; ]' p2 L# h1 H}
5 B9 X: X, A+ Q9 H# K) _else if (document.layers){0 W% G) m4 s. S3 O" h0 S2 I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). F2 @+ s7 S' t- ?# D2 X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 k& V$ Y/ j3 z# O. Kwrite('</ilayer>')
2 {3 x# s: S$ E* Y( D}
* U- W$ l( f1 B& F2 ?document.write('</td></table>')# f  Q  f5 W' A: [
}
. e6 i5 l! V0 c3 u}; ~# M* Q  L: w. s) u; k/ p) q
</script>

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