返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& ~7 U2 w0 b8 S" pvar marqueewidth=300
! Z5 G* ]! u- J4 e) O" W//高度6 L" s1 f$ e+ q
var marqueeheight=255 H' V: h: D4 e# u9 X  E% j
//速度(1-10)
; }+ o' n! Q3 u$ [5 M! K$ h4 V. I/ d. ]var marqueespeed=3
8 U1 r! a* Q. N9 s1 B//背景颜色
; f7 A8 v' f- Z" s9 Jvar marqueebgcolor="#FFFFFF"
, v& n8 f+ \. r) Y+ x' s2 ^+ ]" K: [4 D//是否能暂停 (0=no. 1=yes)?3 m5 c4 q" P( N4 Q) ]4 o' j
var pauseit=1
  U0 |1 A1 ~( a* z: ^  g
6 \3 c6 r1 m; Y6 _$ f; p& v//修改显示内容
% P6 ]- r/ u  K" Z* n% Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 b+ q  L( `* z/ M2 c2 ?: w% o/ `/ Q( A
% b' c( P7 K9 O4 C% Y
////下面不需改变////////////2 q: \  C0 h' o0 o8 s/ [# E

8 ]& J  Q8 a3 i) s. xvar copyspeed=marqueespeed
( n  |, P- ~% h. h1 {var pausespeed=(pauseit==0)? copyspeed: 0
5 J  ^3 P3 L0 m1 `* bvar iedom=document.all||document.getElementById
8 w" H7 F  g8 R0 S6 @if (iedom)9 t0 t0 h  E( ?" I7 q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" f! R3 b% g. i  s6 k- K2 k0 A
var actualwidth=''
# a! q) ~; x! d! Q9 k+ s# |var cross_marquee, ns_marquee  f; R3 q. p5 ^& S. q7 Q/ x

' A  K# ^* @0 u0 v: vfunction populate(){
$ ?  {0 B6 W; K4 x1 A+ h! B2 _if (iedom){
) k5 U4 Y- A9 F9 P! D- Y. ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% I3 X; x, a5 W( Y  F% [3 ], @
cross_marquee.style.left=marqueewidth+8
: g+ p( N$ C: a6 S- ~+ Ncross_marquee.innerHTML=marqueecontent
. I; `  I0 z9 i9 t/ b9 {( Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 V" b& o: W  ~% v}
  Y0 T3 [! Y: ^0 zelse if (document.layers){/ \4 l# }' J! o7 {9 W+ b8 s
ns_marquee=document.ns_marquee.document.ns_marquee2) w  }1 ]) Q8 d6 r  K, `0 Y
ns_marquee.left=marqueewidth+8
" a1 A- \4 f4 T. lns_marquee.document.write(marqueecontent)
3 n- M! Q! a) g" v- J+ tns_marquee.document.close()
+ g5 _& Y' m  vactualwidth=ns_marquee.document.width' O* |& e2 R1 d# T/ t" Q2 p
}
: {$ N* i+ @! |, D2 zlefttime=setInterval("scrollmarquee()",20)  A8 J0 F" z& e" V- v
}8 [; h! g$ _3 Q! w
window.onload=populate
3 ~' f* M+ x  I0 `( ]2 f% d6 n
: ~- Y/ T, T) ^function scrollmarquee(){
! Z% i) x! {/ xif (iedom){5 n" v5 X. q6 ~3 T' \$ a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) S. T. _* x/ F0 E$ n' Q2 r6 H. Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 a5 s8 B$ h6 j2 |3 R3 x/ W/ O
else
0 a( V: Q/ ]& x, H8 G$ k* W8 Ccross_marquee.style.left=marqueewidth+8
2 Y  x* x' Z3 g
, a5 _6 K% B6 l( J) o0 \}
( o& y4 D, s4 L9 [1 o6 q. Melse if (document.layers){6 O! J5 I* z, p
if (ns_marquee.left>(actualwidth*(-1)+8))
8 W* H& G! n' S- fns_marquee.left-=copyspeed
8 M! r2 [4 [! I/ }; c$ B& `7 s% Kelse
, v$ G; C5 e# D6 `" w9 Xns_marquee.left=marqueewidth+8
" ?9 w/ N/ h  d2 U: c9 q$ k}1 }3 }  T$ ?# L2 d5 @- g% V
}
  l) y( z4 ?. I: F& C+ Q
+ p* i0 G" N4 V$ |if (iedom||document.layers){
7 X8 N' W" b1 C3 wwith (document){
6 D5 _1 ~/ V( B5 J9 h' n* Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ Y2 n6 d* |: T5 [; R* ?. r. C" X
if (iedom){
: Z5 q( P" Z- o5 h9 p! Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- S$ I# P. G. X& T* g. I; \/ U2 @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 u; ~6 G( [+ z( S1 r' O5 V3 dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& y+ u2 X' {, ]1 G0 {8 N
write('</div>')
( f' n' c  K; f- ]) U+ z8 _}' s9 M1 `, K$ G& Y$ W+ R
else if (document.layers){
+ O. e2 h2 I+ W7 q& O( Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 C( l9 c! y/ g$ ]4 L5 l) ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! _0 K& Y7 c. x: N9 D  rwrite('</ilayer>')
% F1 p) l2 Q5 S! H9 K9 d}9 I7 Z8 q8 A7 f0 }' k+ l
document.write('</td></table>')5 ^+ T' {1 r/ K# p% @: d4 F
}
3 \& j7 ]( ]: A1 T$ e! [3 K; N}
1 p& S, |, ?  b5 h</script>

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