返回列表 发帖

网页之跑马灯文字特效

//修改宽度( h" p2 f/ g* R' L7 X5 w
var marqueewidth=300
' n+ }" }. p, Q3 W2 B# E! n//高度
( S* q: |! I% N5 T( kvar marqueeheight=255 j+ O: b7 Z. K5 G& O8 W6 X
//速度(1-10)" Q5 z1 Q0 [7 W
var marqueespeed=3/ F* T& y: y3 W7 P
//背景颜色6 @/ u; T4 T  q1 {
var marqueebgcolor="#FFFFFF"
7 N9 L  _: N" c+ X/ r//是否能暂停 (0=no. 1=yes)?- V9 J" C; _" n4 k! o, V! C( R% q
var pauseit=17 Z! n/ s# b; p: @$ G5 v6 l

$ @! {$ Q' k8 m8 |//修改显示内容
' P; H: f9 K& t- x7 pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- G. O9 M; ^$ J/ m. Q6 |

0 ?" q, _' ]# b  Q3 i1 O  }! q7 S. _
  Z$ g/ ^& Q* G% U3 x////下面不需改变////////////
+ |2 Y0 I) v  ^
$ ?2 ?- X4 }2 `) N1 }( zvar copyspeed=marqueespeed
. A! \# X, b) w; b3 Z! p' Jvar pausespeed=(pauseit==0)? copyspeed: 01 L$ m! {9 o. e& ~% |! T+ r
var iedom=document.all||document.getElementById" j( s/ z+ `5 ?7 Y* ?4 \1 k8 N
if (iedom)% X9 F- r. _( W% l" I% C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ R% s' @. h" y. H. F7 l" p' ^/ t3 zvar actualwidth=''" I4 N5 ^/ ?* E, M6 e7 v
var cross_marquee, ns_marquee7 P9 ]/ ~, W, b. n2 f

5 Y! R/ \% n' K: f! h& Q/ w& bfunction populate(){
& t( g$ r  q" l  b: `& @9 yif (iedom){
  U% ]$ f! i& o5 F! q6 W% I3 Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 C  ~) j" q. H7 l6 _% j3 Qcross_marquee.style.left=marqueewidth+8
5 P7 j4 v( g, g- I; G8 O' |) k: Bcross_marquee.innerHTML=marqueecontent
8 F' w1 [0 i7 n3 y- Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 K! [! S$ R/ u6 r3 q  h9 f& K
}
" P1 v% X) t7 Oelse if (document.layers){
8 T" z( k) u$ W2 c+ Lns_marquee=document.ns_marquee.document.ns_marquee2; ]) q; `2 U2 }
ns_marquee.left=marqueewidth+8
: M& A! }# u( x& |4 f* Ins_marquee.document.write(marqueecontent)6 p5 L4 B. x6 V6 e) e
ns_marquee.document.close()5 j, R( |! ~* _; c2 b
actualwidth=ns_marquee.document.width
( [* O& Y+ V6 O6 j$ S+ C; r. E# f& J}! ]3 k/ u* c) n* I
lefttime=setInterval("scrollmarquee()",20)
# Z9 Z( F; }2 F. v: v/ Q! a8 J  s}
1 F# c& O) ?# c5 F( X3 H) Ewindow.onload=populate- `$ D3 G* S8 }6 d/ _- D5 E9 R
$ C8 Y7 |/ x  Z: B5 N
function scrollmarquee(){
6 |- W- P6 p* gif (iedom){
. }8 l) |/ i; ?, w/ yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ J8 m0 w6 s8 t2 ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 U* P, t7 [9 e; X
else3 E8 X5 s& t) H" N( x" M
cross_marquee.style.left=marqueewidth+8
3 i( Y+ I, _! k8 u+ S9 _6 Q* O7 w6 ~$ Z% z6 z# i
}3 A6 b* t) ]9 x4 Y( t; ^2 c
else if (document.layers){
' ~( z+ K1 r. t1 n/ c, C8 Q/ {if (ns_marquee.left>(actualwidth*(-1)+8))
; O* w& ]& Z7 L) o) @& q3 yns_marquee.left-=copyspeed
# x$ G$ i( A2 ~/ q  p7 f( [: Relse
9 @7 C2 S! c7 J9 `. b; O; xns_marquee.left=marqueewidth+8: M, m, t4 {7 Y0 h% c. z5 |/ D
}
: t1 v' z0 Q8 J}' X6 M  X: H9 x0 E4 f/ J1 T

- ]9 Y/ q9 h* f, m; z9 _if (iedom||document.layers){/ R% i1 W& S  Y" W! `
with (document){
2 h* o- Z. x$ {/ h! I/ E1 Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 ~) F3 H- M  z) M, m* m# [0 J
if (iedom){
" x3 {8 ^+ a% \* iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 l6 H' k8 |9 j  @; A# hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- W5 P) P  d% n8 g$ s% K% Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& t2 i9 G9 K' Q. ^8 G; d2 Nwrite('</div>')
/ U  S- b3 v; L2 E9 R# U+ d, Z}
: h5 N  `! d+ k9 b" N: l$ Xelse if (document.layers){
- D$ ]" |, b5 Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( w7 E( v) Y# x" `7 Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 U. H, V8 m6 x; f- F5 X! m4 [write('</ilayer>')0 y6 u& i$ a% A( e. A; ?6 V
}, t5 Q. r8 s* V: ]5 N+ K- C8 o9 R. Q
document.write('</td></table>')
+ t$ v4 O$ F' ~/ d}
' e+ y- ~: u( O6 F* H+ r6 `$ A}6 b5 I* `" A2 L! W+ g
</script>

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