返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 w4 B" ^7 k6 I" D# C+ w. d
var marqueewidth=300
* H) {' H' K3 y" q: I" a5 K! o6 |//高度$ H; t5 D6 g, y1 W' A* p* v
var marqueeheight=25
, O3 p/ ]% z. p7 h. q//速度(1-10)
) W6 S1 H/ c9 Evar marqueespeed=33 Z. O) N5 C+ X( p8 k3 K7 Q
//背景颜色8 y2 }, Z' |: o9 k8 o! a( H
var marqueebgcolor="#FFFFFF", C; d) ]+ A: e
//是否能暂停 (0=no. 1=yes)?, B# z' W8 L: G
var pauseit=1
* V9 s% }+ I  j, `) T; ]
1 O, `# _( \& W& Z4 ]% E- ]//修改显示内容% K. ?; ~7 l, y8 w) {$ [1 n9 `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- ^" O  ]$ M7 J7 w

* ]! a2 Z7 P3 X# H3 X; M/ ]/ W
; F- W  D7 _3 m* L9 p////下面不需改变////////////
) Y$ O. g/ }5 s+ y- L
, y& S6 E9 h, I" Lvar copyspeed=marqueespeed
% I; |+ _0 r# Q& W6 `var pausespeed=(pauseit==0)? copyspeed: 0
* r& U1 w9 C" q( k6 Dvar iedom=document.all||document.getElementById
* x8 g- l$ o1 W7 q+ Aif (iedom)! C" N# v$ b8 N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); }: f3 k2 M" x+ V
var actualwidth=''
' f- C  \0 j5 ]& P& i' Ovar cross_marquee, ns_marquee
1 u$ h! i6 Z  ^  A4 t
" g  [+ X/ K+ S5 ^- U. Dfunction populate(){
$ k- O7 m1 p6 L6 f1 l, {if (iedom){
, |& L0 l- S0 v7 V* [, \cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: b6 T# T2 s2 v0 V
cross_marquee.style.left=marqueewidth+8$ o6 h4 x) w7 m
cross_marquee.innerHTML=marqueecontent2 ~* E* Q% f0 x; C% D" K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! d# v1 r9 c' B8 @, V2 ]7 H
}
, ], e, O" g; f. l4 X# ~else if (document.layers){
- A% n) q* E4 F0 O4 hns_marquee=document.ns_marquee.document.ns_marquee2
7 B6 P8 Z3 Q2 q2 ins_marquee.left=marqueewidth+82 o$ k% M0 R. _7 T
ns_marquee.document.write(marqueecontent)
( B1 [& ^' T. T+ `7 Z0 i; t, `/ lns_marquee.document.close()8 O8 k( J' r& T! ~- v
actualwidth=ns_marquee.document.width
7 z6 `$ }( Z( X}
* `: A, n) t6 G* Q& W4 B* J  u+ Ylefttime=setInterval("scrollmarquee()",20)  ^; z5 O7 V. Y1 R% i
}
/ J+ C* g# |& c* M+ M- Pwindow.onload=populate
* h$ a, C' ]! I( t+ X& O  d  ~6 Z% O$ Q8 ?$ M" h+ v  r
function scrollmarquee(){  X$ i' `) B3 n; ^4 w) `
if (iedom){
5 _9 n  K& `. D4 ~& Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" c) ]& v+ _3 U% c6 P) \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 g% ?7 r- O& \2 g" @0 a" Oelse
( M& q) A) t( c- ]cross_marquee.style.left=marqueewidth+80 P5 {) {& S1 U% |9 U- @; E
, ~5 L: r* l; e1 e7 F
}
! }5 V) G7 _3 \# melse if (document.layers){& H* |# c6 c. }! C
if (ns_marquee.left>(actualwidth*(-1)+8))- ?7 v' {6 s: g$ o
ns_marquee.left-=copyspeed& P( L/ u- h6 w1 f$ s, Y6 U
else
! {  v/ m2 q" b" ]ns_marquee.left=marqueewidth+8
2 d3 q3 ^$ N* M, H$ V1 D1 ?$ \}5 t3 ]/ D. W- E$ Z2 [) ^9 p
}
: ^( _5 l- {& H6 Z
9 E7 t/ E: R6 N) _* a1 U# v; A8 _  aif (iedom||document.layers){+ p" L2 H3 f3 g, ?5 m" a. o
with (document){. y7 c8 i1 i: U0 T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& ], v3 Y  H9 [- e- ~+ `9 ^if (iedom){
, `! Y8 g; j9 U  M! ]" Y' f$ y! I2 Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) f) c% i7 K9 h4 rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* Y/ o9 g' p4 p/ b6 Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! p" U; q+ f2 h% [2 ~5 m
write('</div>')' G/ K" }2 O: a6 c  x7 @' V2 ~
}
/ j& R9 m$ P$ S  r1 e, Z) ?else if (document.layers){0 e2 s- O6 d( s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 F/ g! y6 q6 j* ?& x8 a8 x+ {4 ~! A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& ^, q0 ^. Z3 Z! ~+ ?7 F) [( o
write('</ilayer>')
9 e5 L  }( w* Y" P1 }% X" t6 ^}
) q' v' x2 j- E, Odocument.write('</td></table>')
  _- r9 c# R9 r8 T}. {4 T) w- d$ k, \3 S
}; m# a1 {5 g: B2 Y1 N0 p+ I5 a
</script>

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