返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% e( A* p6 U; n  Rvar marqueewidth=3003 p4 s- Q! f2 G% v
//高度
9 e0 K6 a+ |7 ~0 i: N2 l3 \! ivar marqueeheight=25
1 w5 Z1 R0 n) j$ Z9 _' F//速度(1-10)
' s3 ^+ L. Z8 d( n; c: ^var marqueespeed=3" W% ]' m. h$ ^/ y
//背景颜色
2 l7 }# ]  Z1 ?8 e+ f8 `4 @# |var marqueebgcolor="#FFFFFF"+ z* D  ^. c7 F! \% E& j
//是否能暂停 (0=no. 1=yes)?
/ }2 S0 K' q. o  _; z1 E# E  jvar pauseit=1& N3 Y1 B; W5 K5 X  V

  _& p  ~4 C0 Q; @# D//修改显示内容5 R6 d2 b) [% @6 c5 ~% x7 s" G; h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! G% `. Y! Q; m; C
' }7 u# B: t8 G2 [

: c1 v3 x9 a/ M% A7 D8 P////下面不需改变////////////4 Z; q. I9 F% L0 M2 V
9 M( d) O  ]2 x- x' m" w5 y6 ^
var copyspeed=marqueespeed
$ E; T4 A; }2 Gvar pausespeed=(pauseit==0)? copyspeed: 0  s4 r( \( u' E! j$ o4 O# N
var iedom=document.all||document.getElementById
: s- a; f' B: }! |# uif (iedom)
/ t7 M1 T' N/ x- Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- }3 Z) ~0 I0 k5 ]
var actualwidth=''
( I6 |  e1 d6 a+ ~var cross_marquee, ns_marquee, q; I4 @# a* F6 c6 f" n1 j6 r
  G6 `6 T" U& t% f
function populate(){
0 x! _, F+ d) A7 Rif (iedom){
9 |" b2 d' }5 @0 ~- t. F' Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 `) g% r9 w+ V" w& P0 j
cross_marquee.style.left=marqueewidth+8
+ x& X8 S7 E% |' Z& j6 m# lcross_marquee.innerHTML=marqueecontent; K) E* X- a# J/ \1 E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ t: l* S0 J/ s- j; Y8 b}! s4 Q5 l) I5 t* V
else if (document.layers){( X+ a" {9 N, L7 g$ h+ m
ns_marquee=document.ns_marquee.document.ns_marquee28 K( \# R0 Q3 E& C$ E4 o, _( X
ns_marquee.left=marqueewidth+87 u2 F8 D! `; q/ ?
ns_marquee.document.write(marqueecontent)5 X0 ?3 y  \& E6 e
ns_marquee.document.close()
6 X, P4 P5 b/ D( w. H+ F1 I: Tactualwidth=ns_marquee.document.width
- L* c6 v& f: o8 w  ?}
' b' \' t6 [( z5 E1 [lefttime=setInterval("scrollmarquee()",20)
3 z9 K% _7 B5 l. ]4 C}$ }0 M  m$ F4 J9 P9 P# s9 M
window.onload=populate0 {. F! w" _% `$ u
4 w% J% a3 z% |& P: W; F
function scrollmarquee(){
% |! C, W1 ~0 T- L, W5 @if (iedom){
) e; E' ?3 _* p( u" X( l- tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& |" [6 s; D, D+ \9 o# R3 M6 l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) m' F+ `$ {( L! @+ U& D+ L/ u
else
# K3 q0 Q2 g& H5 H0 ^9 ~3 rcross_marquee.style.left=marqueewidth+86 ^2 p) x) Z+ a; g8 M2 `

: K' s) X* O) Q}8 O$ H5 D8 b9 R
else if (document.layers){
# q- Q+ @2 z. S3 ?+ }9 Zif (ns_marquee.left>(actualwidth*(-1)+8))
1 s3 _2 J# t( Jns_marquee.left-=copyspeed
, [& M: P8 ~% Zelse( S- K7 E2 O) J+ f
ns_marquee.left=marqueewidth+88 e! P! c1 W- s
}+ H) E% p" N7 ^1 n; m* R$ S
}8 j3 B2 I+ q3 I7 \: H5 b+ `' \6 h

/ }; h% [" H9 y1 q% |% J8 {if (iedom||document.layers){1 H& Q/ o5 |- t- C
with (document){6 V) S- U) p9 X& N1 K5 Z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- M) l7 t& C0 L* V5 Dif (iedom){
8 S1 D: M  K. e# _5 {4 owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% A  d* ~& I8 u8 cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 s" Y7 H' M, V; U0 B6 gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ u7 O. ?: b, D, w. Iwrite('</div>')
; v  j- ~2 G! [. A. N% P: z" i}6 w  X- J1 _- Y$ B, T$ I
else if (document.layers){! ?, m) A/ \1 k4 d- Q$ n- U+ o( a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) z. O& \8 }* d9 x( w8 s3 [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 [( g7 _$ {- p3 s8 W; Y2 ~: h: pwrite('</ilayer>')1 ]% `# _& u/ c  D( z: p
}
! x8 j1 y# E7 [9 @) `document.write('</td></table>')$ n1 C3 \3 V/ v7 L! `, \
}
0 i, W' I4 ^/ B% i! W}
% R' A7 y+ ]4 S</script>

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