返回列表 发帖

网页之跑马灯文字特效

//修改宽度( J& O9 p- v/ y$ B1 \
var marqueewidth=300
4 J$ t# C5 A$ Y& z" g; U//高度; t8 k5 v0 W  m7 ~& N: j# r
var marqueeheight=258 Q( o* Y& ]# Y: ?! y% E2 j0 A
//速度(1-10)
8 k9 q2 H) |; w: Fvar marqueespeed=3
  }* r/ k+ u) @5 K9 t  B//背景颜色$ z! Z- J5 Y1 C8 I0 @8 r
var marqueebgcolor="#FFFFFF"
9 ?# G$ q7 i( s5 ]4 [2 c: j- ]* w' P//是否能暂停 (0=no. 1=yes)?" N% u+ e) k  V! h( r8 }. @
var pauseit=1
$ ]9 d$ {5 i: l+ H" A# s' L  I5 ^" L4 P' m# X
//修改显示内容* m7 y3 S  v$ K- H( w2 G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 y% T5 |/ |( ~! O  ]

& r% g- ]9 d7 P, X2 X/ W! a: R
9 b% F* r9 L9 g6 Q( q" l! f2 V////下面不需改变////////////3 b0 P8 ~6 O2 [. y* F5 ~5 r
; u7 \! h2 T$ s7 J) }+ Q
var copyspeed=marqueespeed
. `6 U: Q/ f3 i) ^4 r+ j; X  h5 evar pausespeed=(pauseit==0)? copyspeed: 0, M9 N  N% l+ p, _- @4 ^
var iedom=document.all||document.getElementById. r. `" d' N7 W1 `0 a% W
if (iedom)" T0 Z( Z4 Y3 J% D; z- I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( ]" t% G  P1 A' L2 Pvar actualwidth=''
- Z7 `, q- P. k  u8 p+ F- e$ Hvar cross_marquee, ns_marquee
2 s# z* {- X; o" c2 {) W; E) |, J
1 i% j5 m1 `4 ^% b$ ^function populate(){2 B! x8 }6 D* \& ^
if (iedom){
5 R2 F! ?3 I$ X" `% E( f" fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! n! n) z, g7 d$ s3 V
cross_marquee.style.left=marqueewidth+8
1 c2 \1 K* l7 K( p" k, e0 ocross_marquee.innerHTML=marqueecontent
* f1 `& W: N, R' `$ Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 k0 M% U0 r1 p: P# _
}4 h* V; O4 G) l% ~+ c) G- c, g5 q; i
else if (document.layers){
2 A2 V1 ?, V3 E+ Q2 q' G- Cns_marquee=document.ns_marquee.document.ns_marquee2/ [( h7 y2 t$ V& ~: B3 X
ns_marquee.left=marqueewidth+8
- o/ E. f+ G. R& P) B5 |1 x) J8 fns_marquee.document.write(marqueecontent)
8 d1 H- X$ v6 Z4 [) B# h6 pns_marquee.document.close()/ T0 J6 M& ?! u- f$ s7 h9 A5 d
actualwidth=ns_marquee.document.width
6 Q# S" [9 J8 L2 E}
$ ?! k% j1 Y$ c5 k6 V# Flefttime=setInterval("scrollmarquee()",20)
! _( L6 r8 l  I5 r; n9 R0 N}' t( {- w1 m9 L) z! H0 p" c( V; @
window.onload=populate
8 N. i7 z9 h+ W. H! D& z* I5 i
. O( ?7 h: J9 q9 bfunction scrollmarquee(){
% v+ ^( r% S3 S7 {; n* s8 o) lif (iedom){
8 s* i& G. G& c% I! [* v4 Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ d9 \1 d% o3 d5 ?3 q. \5 _6 r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ B. E8 s7 H# X9 Z: R1 eelse
, i# [# a; G. kcross_marquee.style.left=marqueewidth+8
: b' R3 Z' e- F  p& _2 E3 a. o* `, J% p1 V  R9 m
}
+ S7 F) ]+ X3 L+ ~else if (document.layers){5 k# w8 O8 t; o; P1 W+ b% I
if (ns_marquee.left>(actualwidth*(-1)+8))
7 L+ m9 I" C8 G7 l7 \2 l* v0 y1 I& qns_marquee.left-=copyspeed  k* c, s+ ?/ n
else9 X# C) e' W5 D3 B( x' G  D2 y
ns_marquee.left=marqueewidth+8" Z& }  T  w8 Y0 D9 X4 q
}1 L, ]  n7 X4 e) k# k6 a
}; t. |. h6 ~; T8 f( C" D
6 ~7 i: J3 V4 Y/ q
if (iedom||document.layers){
8 E; d& Z/ }5 l1 D/ V- D) C5 @with (document){
1 m7 s0 I& Y2 w9 Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( y; G' E4 @4 l, f; Iif (iedom){
' b2 n: D2 `0 n) Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 ]; k2 Q/ S8 r4 q5 d, {6 C/ fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- y; x: E8 g+ q7 |1 g. o4 {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ h4 I9 \% ?1 E; _' a# |write('</div>')
# X& v0 c# E7 {; v}
- y2 R$ o$ R: H- D* Nelse if (document.layers){& S1 _. r' K$ C# i/ T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 R0 s* V- I* W6 \" y# R" V- S& Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! B) W' i$ m* w
write('</ilayer>')
+ @/ b  a* Z! C+ k}
# J/ P/ b/ n/ q8 E1 g5 [8 Pdocument.write('</td></table>')
9 k0 ^( X5 q1 n}5 a8 Q9 j& d+ c
}
5 c6 L7 b9 I9 ~  {' F5 b</script>

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