返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) }* z7 c2 B+ C0 {5 f/ Avar marqueewidth=300
& i9 m8 W" B9 h) R6 B//高度. L7 b4 ?! R6 j) h: C3 [
var marqueeheight=25
$ Q" R8 m- q. n3 z//速度(1-10)5 C' n; Z. `; P) i" m
var marqueespeed=3, T% L6 X! M- h7 E5 a" U" L
//背景颜色' Q& ~' ]  e3 A
var marqueebgcolor="#FFFFFF"- V6 o, J# @1 b/ I) G' v
//是否能暂停 (0=no. 1=yes)?
6 P# i5 w* [3 Jvar pauseit=1. j% ~8 a) R$ t* S- o- f

- P0 Z) c9 ?6 ?# w$ T1 r//修改显示内容8 N* a5 N& M$ `. X6 X/ V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* [6 T& v- C7 b- D; \+ t8 D7 g
; d, L7 T% W8 ^$ u* V( z
( O# D2 O/ \; E* U& h- b1 T9 z
////下面不需改变////////////6 H1 A5 Y* v! m& M( o7 ^" L

1 x5 v4 E9 B$ R* \var copyspeed=marqueespeed/ s* q3 |. s, W
var pausespeed=(pauseit==0)? copyspeed: 0
+ Y6 \3 n! O7 z6 N8 n+ Kvar iedom=document.all||document.getElementById
+ G" a$ b& {3 C5 Wif (iedom)" V3 W2 D& v1 B, B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% y# b7 I* [' l" w
var actualwidth='', V: @; Z  s4 c1 @% x4 j
var cross_marquee, ns_marquee5 L- k+ ?/ y1 B5 j- Y
  i) `/ O3 W6 o9 R
function populate(){; s1 w- I$ M$ W, Y3 B. c& A
if (iedom){; B' l3 d4 `( Z/ e( n$ U+ X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  r8 V5 E4 o# O  B% L# X
cross_marquee.style.left=marqueewidth+8
) r* a- f4 w8 ~( A+ E  F" L; tcross_marquee.innerHTML=marqueecontent
1 I3 q9 U6 ~/ H, y* I' g" ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( ~% u5 }0 ?1 B7 }7 t}: I' w) B2 b0 c5 u. _# _% C
else if (document.layers){% b$ c1 r4 `+ }2 d
ns_marquee=document.ns_marquee.document.ns_marquee2
/ d; Q# o0 p3 _; v1 h/ b3 M) Dns_marquee.left=marqueewidth+8
5 s8 h) f: u+ }6 j/ w$ C: |ns_marquee.document.write(marqueecontent)
" X8 p% P* l4 rns_marquee.document.close()2 l' O) f; f0 b3 q0 ~
actualwidth=ns_marquee.document.width
: V0 {" l7 ^( h1 A}
! a2 K$ l$ z5 }( I% q  {" |lefttime=setInterval("scrollmarquee()",20)
0 U/ [, O8 J3 U8 l; y, q}
! \6 f7 m. k2 K0 |4 I9 k0 M3 Twindow.onload=populate
& ]0 |" b- `. D+ M/ J0 H6 B3 r% {
function scrollmarquee(){" }. D+ u. e- ^" S/ z1 [
if (iedom){
; [# h; @: b$ ^' L0 L! fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 u5 W, M; o" xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! R- F% D/ l$ _: U: K& E5 lelse
! F0 o" \4 Q& k' O' Fcross_marquee.style.left=marqueewidth+8. Z4 F( D9 w' F; E& a1 h
+ ?/ A; M+ J2 G. I
}' j) |$ C8 m1 L3 t/ ?2 S% q
else if (document.layers){
3 q* T. k  A4 Gif (ns_marquee.left>(actualwidth*(-1)+8))" O5 z+ a7 e9 i4 O/ [
ns_marquee.left-=copyspeed8 F1 d) c' g: {/ N
else$ w2 J% g# _1 V! }# o9 x
ns_marquee.left=marqueewidth+89 U, h1 U1 S7 ]" P3 Q# ~8 p
}
3 O4 d# z  P) z! e6 a* C/ _. q. N}: I" j( o; {9 Z2 J8 S. s; r+ j
  a' L/ \* w$ i, j9 o; t  S/ }
if (iedom||document.layers){
1 V5 P) v1 \# m7 `/ [% \with (document){
, g" c* ]/ \3 k* e+ Z) ^" D" Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: Z# b; Q3 B. @( g* Dif (iedom){
5 R) e8 c. {1 O) s8 E. Y6 ]( C3 nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ P5 }/ T$ A0 c" f7 N& \! vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 m  f) I& [4 v: F- uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ e% k! o1 J+ H8 q8 m6 f
write('</div>')
3 m  n9 V* C/ N! |; P- d2 G6 i% o3 H}
. F, v' A+ ^0 L/ ~' D' n  Felse if (document.layers){, ], a$ J1 E  D, m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( l# g9 _) w. l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% t1 b/ h0 s  b) |4 _1 Y$ g4 F
write('</ilayer>')" T+ n$ x. H* G' w' h/ `
}
) B" G" W1 s3 M$ ?7 Idocument.write('</td></table>')
5 G3 I3 j' {( V0 G}
) q; s" U) p: \. ^" ^8 [, m% c; |}
6 J) ~2 h4 Z/ f7 c) G</script>

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