返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 w, _# i0 C5 W% [. Lvar marqueewidth=300
3 S" V2 n/ b, h1 L! V" L//高度3 p, T% D9 u$ X. F  \
var marqueeheight=25
$ c7 e/ X( ^6 }( Q' U, G( f//速度(1-10): y$ K( Q% D' ]
var marqueespeed=3
5 @& Y+ H! m5 B. ^+ P3 U: G. a2 h//背景颜色2 n) m- c- H% r7 Y' ~
var marqueebgcolor="#FFFFFF"7 y1 k' o, [( q0 m6 ^. L4 `/ B
//是否能暂停 (0=no. 1=yes)?! R. t$ U& ~% `- p6 j
var pauseit=13 Q" R7 e: z4 W: `8 F% S
) M4 h+ j9 h" B+ Z
//修改显示内容
7 Q5 Y% ?9 R4 V1 [' evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 }1 }* l% K1 B; g$ n

' k* c8 ?! H' K* ^; }
9 t6 _1 T! v! J% I9 v' b+ R////下面不需改变////////////
! d) w/ Y+ @. ?* s+ T4 Y: E* X( g6 E; s- S, ^
var copyspeed=marqueespeed; l! I- o, S/ Q
var pausespeed=(pauseit==0)? copyspeed: 0% A& q: J) l2 ^$ [9 r1 M
var iedom=document.all||document.getElementById
* N2 r  C; |: {2 qif (iedom)
  |1 n" d; l2 l" K9 @; [9 `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 u1 x! G5 \) O2 ]$ X: Z7 \
var actualwidth=''
: P% k: j" y- @- m9 zvar cross_marquee, ns_marquee6 k, }+ s1 e5 G8 I9 u

! q' h1 `; H$ a4 S1 m" G6 t) Ofunction populate(){! y* o. O  z# H$ J  P" B
if (iedom){. Y3 {4 A- e) C4 l( t1 i/ I1 q! ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, Z) k# e; ^- [. v" G0 mcross_marquee.style.left=marqueewidth+8
- G+ y' {" B  a3 c  jcross_marquee.innerHTML=marqueecontent" Q8 g2 D+ P# Y) i6 t% ~$ i. u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 w, C' n* n& D' K3 e
}
3 M( {3 [: X6 }- H6 g2 lelse if (document.layers){! d2 w+ K3 ^+ Z( G8 B4 N5 F% |' \
ns_marquee=document.ns_marquee.document.ns_marquee2
" ^; D9 N& T& {" cns_marquee.left=marqueewidth+8  J& ]! t- X% C' |4 f0 q
ns_marquee.document.write(marqueecontent)
: K% C# j2 o+ Ans_marquee.document.close()$ |; p. f1 H2 `
actualwidth=ns_marquee.document.width3 _0 q  ^+ p5 t7 ?9 ^
}
, ^9 w% _* P; ^1 G# R2 u* C( zlefttime=setInterval("scrollmarquee()",20)
& A4 W+ V; b0 t: g}# y' K0 x7 R- ^8 `$ T7 i5 z* L6 y! t
window.onload=populate
7 o+ Y5 V' \9 j) t; f; Q/ B& N6 c6 [/ H; ~) [% f" Q. |
function scrollmarquee(){+ B* m, O# m. B! B  c  t1 }  [1 f3 O
if (iedom){
5 s8 H6 w& Z, D# i7 hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* e  o+ j2 v6 W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 b8 y/ B) P5 h  B6 r+ {* qelse% B7 J* ^7 _; Q2 G2 N
cross_marquee.style.left=marqueewidth+82 L, W8 O7 f! X9 i+ G
6 |# m9 g% B3 h# G( U7 r4 o
}
9 J+ G' w2 ]: O5 E6 z8 e/ Lelse if (document.layers){
5 u( u9 g3 W1 M5 vif (ns_marquee.left>(actualwidth*(-1)+8))' d. }4 N' w) Q2 m. H
ns_marquee.left-=copyspeed
. \7 V6 X2 N: s8 delse8 I1 z) C6 r) j2 f% Y3 r
ns_marquee.left=marqueewidth+8
4 z3 m1 m; [% {' r) M, ]5 `}
# W2 P+ o2 G" j$ C7 H; l}
  j0 V* @; Z* W; s) o8 ^+ r# W5 q6 \7 L
if (iedom||document.layers){4 x0 ~" |2 C5 X+ x% s( W$ x. V
with (document){- ?' R% I( |2 M* g: v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 Z" S5 j/ ?" V/ L' gif (iedom){
: W0 E5 S5 I" A& t/ vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ ~0 j+ y" R3 n. V# vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ {% P, U  g8 `) V6 a, ?2 ]3 _4 }5 r! J# p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 m' i0 S5 v  ]9 M7 h& T! Y' x2 I* Owrite('</div>')
0 `0 b8 {% [  w! Y  E# L% D9 _0 {}* @3 Z; k2 b7 F8 s. q; V6 @
else if (document.layers){  ^0 O; D2 u9 @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ l# B7 {# e* \% h! x0 P! T3 Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 i) c% t( w! x& X& t# _( V! h
write('</ilayer>')
, k9 ~, d/ i0 h7 z}
& `4 b8 |3 g" }  ^( Y; }document.write('</td></table>')
& ^! J9 \, W  Y3 A, ]( ^- \}0 {# ^5 |7 c8 d$ W  u* H. R" P& l
}( Z+ ]9 {5 p* _. s+ X; S2 J' ^
</script>

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