返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ H% n' f% Q( ~  I' V0 Evar marqueewidth=300
/ j$ T% F- {, h$ n, P2 R% R6 r//高度
7 h5 l, }. \3 B+ j( Ivar marqueeheight=25  t  W9 A- ^4 c: ?
//速度(1-10)+ M2 ~+ H( g) r7 L  ^" G
var marqueespeed=3, n; G' G5 `- s6 q3 M5 E: d
//背景颜色
7 g- H4 {0 K* j" n4 S, Qvar marqueebgcolor="#FFFFFF") {' l- @8 ~' C6 ?7 _' B$ _6 n
//是否能暂停 (0=no. 1=yes)?- |$ m. I: |# S
var pauseit=1
' }9 v6 D5 h# Q- O' I* c
" |1 b9 L9 `4 a//修改显示内容: ]" C. s: c% }6 l8 D+ }3 i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 N0 X5 A7 a1 Z
* M; ~9 s$ f4 }; E9 B

2 @6 J( b! H) Q/ ~0 `7 K2 W////下面不需改变////////////
  x4 y! ~0 |1 l& N
0 @4 V) j" k9 |& B( v4 x, tvar copyspeed=marqueespeed
5 q3 h3 h! S) G6 w5 @! m7 Q+ Tvar pausespeed=(pauseit==0)? copyspeed: 0, O1 L& [* q: |1 I! U& l
var iedom=document.all||document.getElementById
! k& d6 x3 `! k/ |/ |( t4 M1 i5 ^if (iedom). i  J9 w0 x; H; t* E2 ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 x7 c/ M5 f, I. N
var actualwidth=''6 i2 f3 d5 _4 h% a
var cross_marquee, ns_marquee# R$ F% j8 e, K# j4 C3 R$ H
; S' j! t4 c7 W' c& ?8 ?- {2 B
function populate(){3 i2 a  v1 u/ f* Y: Y
if (iedom){3 f$ \: O) h& s& J' a5 C; H0 y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 _7 z2 P( H7 T9 k
cross_marquee.style.left=marqueewidth+8. Z9 Y# d' x7 y/ i5 w
cross_marquee.innerHTML=marqueecontent! h7 Y; T& `. E, ?# I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 R; x9 j  Q0 l% o* \; f2 N: K}
; O; q; k$ }- m4 Y" j$ welse if (document.layers){/ S! S4 j) Q* l4 Q8 y* P4 }
ns_marquee=document.ns_marquee.document.ns_marquee2  L8 p/ H; R5 x
ns_marquee.left=marqueewidth+8" j3 Q  v% H8 {; c
ns_marquee.document.write(marqueecontent)
6 z- H+ H! t4 p9 Mns_marquee.document.close()8 t8 b, O) w0 u3 L' Z5 h
actualwidth=ns_marquee.document.width! J5 Q# v4 l0 u- a, T5 d: z
}
. w0 v) Q" h. r8 R6 ~: ~  q/ Ulefttime=setInterval("scrollmarquee()",20)$ V, K) g% @# o- k
}/ |, ?1 C, x( l& }  _, S
window.onload=populate
5 n1 n# M; \' Q+ n' X2 H9 e
1 ?  Q" f$ y. Z5 Y/ p! ~# j, L, yfunction scrollmarquee(){$ A0 d( U' w; G/ Q" g* W6 e
if (iedom){+ ], y* X# \- [" ^  z( r9 w2 z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), m& p5 E6 a+ y6 Y) R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& a. C7 \/ k* f  ]
else2 o  n8 g9 b& P) c1 }2 ^% \
cross_marquee.style.left=marqueewidth+8
" L$ x. i$ v- V, f3 b7 d' v
! g- @  @  P3 l( `. O}
* B2 c1 z7 }8 yelse if (document.layers){) y# [' j! U6 d# n
if (ns_marquee.left>(actualwidth*(-1)+8))
$ Z* x# P) s% d" k& r7 qns_marquee.left-=copyspeed3 t( }) t( X+ E( ^+ h
else
2 G2 y9 y) e$ s2 Z# {* g5 uns_marquee.left=marqueewidth+8
* V* t3 }- e1 A: E& m/ S' k}2 [4 L6 Z9 B5 A' ?9 I  K
}
. e. ?, c  g8 N$ \0 {" A0 Y8 U
; d! h$ g7 o, `  P; T/ R4 b! Dif (iedom||document.layers){
1 W; t3 w" d1 c5 U' W8 J" j- f6 ywith (document){
) x$ l( h3 J6 ]" u& q+ F. ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ R7 a+ W& ~1 m2 Lif (iedom){
( |! J1 x* X  W7 I& Z# Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! Y7 l' |, c+ Q9 Y* N6 w# ?5 k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ e1 f% a: F: \* M8 Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 T/ {( K2 |0 L6 M. Mwrite('</div>')
+ L4 E6 _4 Z7 R# Z; ?+ R}+ w- Q; }# C/ ~7 b$ _% V
else if (document.layers){2 \* l1 d: k( t. B% [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ n* W, X) p' P7 b6 N+ mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 }' W$ n( R3 B/ H$ L) u* uwrite('</ilayer>')
; t/ l; c, Y& Z  z$ N}5 k' s! p2 T) k; o$ r
document.write('</td></table>')$ h6 C# D0 X5 w( f$ ^
}
/ B3 w" X9 u* Q' @}7 O( M$ y, X/ N0 ~) ]. n
</script>

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