返回列表 发帖

网页之跑马灯文字特效

//修改宽度  R5 u  J7 [" S5 H: X* _8 U# q5 h
var marqueewidth=300* f% n6 J9 ]( \2 D" E
//高度
# G" {. C. I4 R( Fvar marqueeheight=257 d. }) s8 ]; ~: L' G4 H2 a
//速度(1-10)* c. p* b9 B. d8 V1 K
var marqueespeed=3% h8 i! d4 ?- M& q/ C& S* j$ I
//背景颜色
: ^" U% W1 z; e9 Y2 Qvar marqueebgcolor="#FFFFFF"
$ J& z& d6 g  v0 T% Z//是否能暂停 (0=no. 1=yes)?! O5 \' }) ^$ b4 m# k
var pauseit=13 J0 s) X/ }5 h  y1 b2 T

! M( |  `* n2 C' z. a//修改显示内容8 ~, Y  K  r; B8 ]& {. }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 W5 d, F& X% U9 K/ N/ Q8 C$ h' u
2 F0 }8 R/ O$ }8 S
$ g" t- L' j. G: z9 K4 M) b
////下面不需改变////////////- c6 J+ w2 r9 j3 h) Y2 E

& \; N' ~. O6 G) Y# R( ^var copyspeed=marqueespeed
5 h; x8 O( c) D  p, h( H( ]# H9 ivar pausespeed=(pauseit==0)? copyspeed: 0: G2 N2 N1 \, \" D1 A5 l/ Y; X
var iedom=document.all||document.getElementById
6 h3 A- ^! s. `% V- I5 K& Zif (iedom)- P! \4 p5 d6 [0 b  p+ i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  c* A0 y; C$ s
var actualwidth=''- f0 _+ i8 V( C" C5 U6 z
var cross_marquee, ns_marquee
5 }+ r( f( Q+ f6 h! S# s6 y; N! E9 y7 E* ~
function populate(){! @/ w4 i9 s9 p: f
if (iedom){6 k- n2 L) o% Y" k9 y7 u& w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' D5 B4 n; u9 H( z- Z( F# G8 w
cross_marquee.style.left=marqueewidth+8- s3 U; i1 e: Z6 p
cross_marquee.innerHTML=marqueecontent) q# G( Y: k3 A% T/ S. ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! P$ i9 D) N% j! S8 i0 c/ K}
, X( G" R. J6 w2 f2 J" K3 ^else if (document.layers){/ O& V( B- S8 n; I$ V* F
ns_marquee=document.ns_marquee.document.ns_marquee2
' n& V0 Z# w9 ]* r2 z- U/ _ns_marquee.left=marqueewidth+88 V+ A& ~# D# k/ B8 _+ R) Q) t
ns_marquee.document.write(marqueecontent)  l# `. |! Y& t) q3 \1 j1 p
ns_marquee.document.close()" k! }* ?$ w9 V) }9 j
actualwidth=ns_marquee.document.width2 `: ?* Z( ?0 s# n, J" y
}$ K$ v; V4 Y  r5 T, |: k
lefttime=setInterval("scrollmarquee()",20)
9 B+ f0 o8 }6 ]1 I}7 ]7 e, }/ J" j! }& w7 W# |0 M
window.onload=populate
7 w1 L% J! n5 N& k: `8 J% l* E7 v8 j$ t  E# k; A% F7 f& l' F" }
function scrollmarquee(){/ E+ f) k, W# |9 @+ T
if (iedom){
; n/ e3 v; X0 Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), T8 [, X, E# o: P) t3 |0 I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 y2 u& ^) ^# d4 H* n1 h% oelse
5 A2 l; [. F$ c4 X: Jcross_marquee.style.left=marqueewidth+80 V* v2 f; M. ]

# Q! H' o/ u" U; y  z6 |' u}
" i7 L% p5 p4 \" [else if (document.layers){- i# X& ^0 T6 l6 F
if (ns_marquee.left>(actualwidth*(-1)+8))% K9 @/ c2 m& p
ns_marquee.left-=copyspeed: p- k* v$ v& ~2 Q$ T3 P
else8 F( F" f& y# j1 C  r# x; R7 s
ns_marquee.left=marqueewidth+8& _7 V& e5 V9 @
}6 z  p7 K  ~5 H& @  l2 K1 L
}* e4 f2 @+ U+ h- L% a9 R+ f1 h( |7 r

6 Y! S1 y$ M% U1 i: Kif (iedom||document.layers){: O/ v( M$ R1 o# S0 @; |* T8 q$ P
with (document){" ^& t2 e( t/ L9 ?; ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! _/ Z% b4 D: X6 A0 F
if (iedom){
2 P1 l5 H9 q( Z1 h3 zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): K  u- ?6 C' c7 c$ [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 n; `# R) q( m5 [0 swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 L' f( @, a  e4 lwrite('</div>')
3 g: D3 t9 i% L1 P! k* q" o}7 \3 d/ k7 E* X7 d: V& u0 N
else if (document.layers){
8 a( _  ]6 ^6 r0 n5 N" v# Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 I+ k* a/ M0 m  t1 ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 [; v$ C+ k1 I& B# G
write('</ilayer>')8 [7 N4 V# P& G+ w+ d
}
2 R8 Y/ U) K9 ndocument.write('</td></table>')
/ {: t+ S" x9 g9 H8 X}9 O% I) R4 o9 I8 y' x& Y" {
}
* S2 Q' x# ?; D) I</script>

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