返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- I5 u/ A" \* w& {var marqueewidth=300
) y% j) J9 L7 q+ F: L, W$ b//高度6 Y) v8 b; d9 Y# m1 j0 |; R
var marqueeheight=259 o" E( i- l6 ]  \5 P" Y" G" }$ J1 g
//速度(1-10)
0 Z6 e; s6 T, dvar marqueespeed=3: v8 G! V4 [7 Z. ~& l+ Y
//背景颜色! s4 u, w/ _: x! L# Y9 B: ~7 ~) n7 |
var marqueebgcolor="#FFFFFF"
& i" F9 R% V9 ~8 A. j& g//是否能暂停 (0=no. 1=yes)?
2 a8 G6 m; N" evar pauseit=1
6 Z; o: l# |+ w& e+ B) U- Z1 \' D* z
//修改显示内容& u7 Y) l# V0 U" g: b+ U- t; }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( F% O4 M" H$ f* N

" U9 U! [. E; C9 O8 C* i. k) A* O: K
. h3 X* T  j) _- H////下面不需改变////////////' i+ m( r5 p8 N% m8 }

3 y* M' l/ k, d* L% ?$ zvar copyspeed=marqueespeed: B7 D  J! g! R- h0 x6 W: I+ W
var pausespeed=(pauseit==0)? copyspeed: 0' s9 b4 V- w  I" U% O
var iedom=document.all||document.getElementById2 J+ l  J' [/ i' B( m4 K! b4 {
if (iedom)! h: ^6 A: q$ w3 a8 A2 e- ?1 x8 [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' p7 G, j0 X& \2 {var actualwidth=''
9 ^' j; p) E( E6 ~7 K. y" R* P  ]+ Fvar cross_marquee, ns_marquee
: J6 f" e  }# a. h9 F& d4 F
- {6 o2 E8 b1 T* }function populate(){
& f. ]5 i) W, ?2 J: l9 h; b0 J2 \if (iedom){
" E6 x; K! A* A  Q" \cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 B3 R# a" f; s
cross_marquee.style.left=marqueewidth+8
) r9 V: k! H% J. Z5 Y1 c. Ecross_marquee.innerHTML=marqueecontent! J$ q/ O& R6 {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, Z( U" p& p5 g* e6 z; I}, B; m; J" `/ J3 z9 D: R  ?- A5 b
else if (document.layers){
( [( y2 r* q$ N  r. Xns_marquee=document.ns_marquee.document.ns_marquee2
' e3 g6 i% l  W  b5 rns_marquee.left=marqueewidth+8* q2 N1 t- P* P# m+ C. ^- K6 ^
ns_marquee.document.write(marqueecontent)
; b/ X- D1 b0 |# B3 ~" Mns_marquee.document.close()* Z1 T: n; b: t
actualwidth=ns_marquee.document.width
6 r$ ^1 M# d+ u& s/ P* H}, [; X' d: N5 b. g& N7 j+ I
lefttime=setInterval("scrollmarquee()",20)4 S( J% W: I& V
}
! `' _  J" L1 s. R. twindow.onload=populate% a, t2 l+ L  k3 M: ?% J

3 B: B: _! U. P  n- u! ffunction scrollmarquee(){
7 f* c, d% X& L8 W7 \4 \if (iedom){. ~# @& h+ R( B( H& O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; [0 h5 B/ Q. I2 @' Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: T. `" a9 p  U+ k$ L& n5 A3 O$ welse& t: _' s& t2 ]4 u5 ~
cross_marquee.style.left=marqueewidth+81 [% l8 W8 X* l- `2 ]3 z
$ {8 s4 }( U: e4 n6 b% d& ]
}
8 B! F8 `( N3 \/ F1 |else if (document.layers){
6 G2 V, k0 Z0 l3 P+ U  b2 Vif (ns_marquee.left>(actualwidth*(-1)+8))% W" m7 j; L: N' P) E  Q
ns_marquee.left-=copyspeed& C4 x1 N" t0 F+ j
else
/ N' s( @4 {( Y& N% s, q6 Rns_marquee.left=marqueewidth+8
  O& V# O, g0 c' |/ g}
" w2 m# n" L' D# ~7 W- l9 d/ |2 u}- F. l& m- i/ T

+ ~9 t8 C% w! I( J! pif (iedom||document.layers){
3 S2 l& Z+ ^) R# |with (document){6 f" V2 T( E9 l( S- H/ X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, V1 h* E5 e4 M6 m$ g& N7 Zif (iedom){  l8 G* t4 B) q8 \$ w: E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. b; w  F% e/ C% D+ ?" q1 R% f6 ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# a) B, d3 `8 w0 X* K* h9 Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 L( ~) g3 b! Y. T
write('</div>')
; u+ r+ k5 e  S- ]5 w}
( z) N4 I& {- y5 N9 s% Q5 relse if (document.layers){
' A, r- f1 p" cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). Q5 t8 z, P* g! ]" `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 j( \+ p0 ?- d( ~7 M
write('</ilayer>')! M# l% j" a& x' G) b" B
}
1 [) t7 S% [. R4 `document.write('</td></table>')! k, A8 r9 J' o4 {& F
}) \( D7 J4 ?) Y6 C3 ^7 k
}# V' U4 i  q1 z- u: o9 x
</script>

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