返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 {! G; R# R  [) e7 b5 f; ~! M
var marqueewidth=3005 K, D8 E9 ]1 w2 K
//高度
4 }( \: g) L. K7 a5 r$ A" v# D; dvar marqueeheight=25* O2 ?( s+ U! x" R" g, k! Q
//速度(1-10)
% }1 x  ~) w( M1 U# {var marqueespeed=3" Q" n5 Z5 k! p* t
//背景颜色
% L2 W1 V: i: l  Z; W# mvar marqueebgcolor="#FFFFFF"
3 C- o6 K. c1 f% b& E1 m//是否能暂停 (0=no. 1=yes)?9 P( P7 d: d9 x- A+ }" q
var pauseit=1) T) V2 a+ V! |

5 n7 {' I6 O$ Z7 |/ X, I4 b//修改显示内容
4 g4 A3 f" E' ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# D0 v. s0 a( Z9 N9 t! s$ o* x3 D) a( k& v/ T" Z

  t& n" [0 x2 U$ i% @: g////下面不需改变////////////
  ^- G# E. q/ E2 G- y; t, z
$ T9 D+ v4 w$ ~+ t5 g' T* Zvar copyspeed=marqueespeed! j/ y7 Q( @$ }/ o7 {: f
var pausespeed=(pauseit==0)? copyspeed: 03 G5 y& _/ P' w$ N6 F/ @2 L3 ~- f
var iedom=document.all||document.getElementById
  m( U# V& w& J# G7 v2 aif (iedom)% A: ^1 _; H9 U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 Q1 z/ ]7 M! K' S' h# {# mvar actualwidth=''. p+ H$ |" G: S! {) i+ Z2 O7 F0 m" Q
var cross_marquee, ns_marquee
8 N; K/ g% T# U" I1 U6 |
1 @' U2 e1 q. |2 A* ifunction populate(){
$ d$ J9 x" E; h3 Lif (iedom){6 T1 T/ C  ^. l* a' w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: P$ r; R2 _% e4 ^& }
cross_marquee.style.left=marqueewidth+8/ i4 i. G3 [" s  \1 d
cross_marquee.innerHTML=marqueecontent
( x# M5 N: c9 Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ J; R2 y! h: E/ }}+ K0 Z; q: I9 q# t0 C3 P% C
else if (document.layers){
: ?: n  m4 ?6 x8 N: \ns_marquee=document.ns_marquee.document.ns_marquee25 ^6 H9 L6 J4 y  n; L, c  J+ A
ns_marquee.left=marqueewidth+8) @% X# u7 j+ J" X& q+ N( T
ns_marquee.document.write(marqueecontent)- Y# J0 \" t$ H4 W( K" C7 f
ns_marquee.document.close()4 @5 c8 F1 c( R; a# }! N
actualwidth=ns_marquee.document.width
. K! U2 r1 e; c0 z! r1 X}
- r6 l+ x( ]% w& b3 }lefttime=setInterval("scrollmarquee()",20)
0 W; f$ x. T. {; D}/ q: W$ X; A7 t! z2 {2 b  Q
window.onload=populate8 k* c% ~1 G/ J* ]& Z3 C; ~3 p9 y* G
( v1 V# r0 o7 O/ K* q
function scrollmarquee(){
* p* r$ S) c7 l  yif (iedom){! _1 r7 c  l9 T2 k. y9 d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) X% t4 `5 Y5 G# K- ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 ?4 n; v, B) Ielse: _+ d. u) g1 y# ]
cross_marquee.style.left=marqueewidth+8
; _" R7 H8 T- t8 l+ C' p. g" G$ i( W& Y# L8 |/ W! u: W
}; e8 p* R, D4 G+ R% B" C$ R# v! Q
else if (document.layers){
3 Y" |' S. z9 c% n& g& |if (ns_marquee.left>(actualwidth*(-1)+8))/ m  p- S+ R, L  z! G
ns_marquee.left-=copyspeed5 o9 A+ I5 t4 @9 F; H/ l2 \
else
0 L0 h$ p* K  \( |ns_marquee.left=marqueewidth+82 Z3 c5 P! q9 a$ k  W
}% S' y, f  D+ {4 f
}- ~1 _1 B- o( u. g6 g! V

$ _9 R8 F/ O+ P- K4 Q( \: h" g4 xif (iedom||document.layers){: C/ o8 d$ c+ x$ g
with (document){
: y- d; [7 o$ G& `/ m' X3 Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  `* r0 h) F. W$ K4 S  M. O7 I
if (iedom){
; O) i" m! [/ _9 D& p! z' S3 wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 s; i6 {6 f6 P/ Y# H& w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 j7 w& o0 |7 _: I
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  D: @% L- I. P1 ~5 W: `# s
write('</div>')
' x# P: Q& N  I7 ?, t}- t3 ?* Q2 H; w' d
else if (document.layers){
4 y3 k7 C  X" Y: ~) c- r! W+ R, iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 k  Y% m- |" b7 @* g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! r; U- M* L0 [  N/ j
write('</ilayer>')
$ j$ N- y, \! z) @( z7 {}
6 x+ Z& U4 f3 _: V) k4 Kdocument.write('</td></table>')1 B/ d; w# m( x/ m" W; m
}5 u2 v0 d3 a* c7 \; X2 a
}
. m" X( c- M! ?7 u7 Z/ ?$ p</script>

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