返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% j; \) s. }0 }8 x! J+ w- \var marqueewidth=3003 F7 d+ g: r5 b7 M- [
//高度
/ r, ~) l' L9 i  qvar marqueeheight=25( L5 ~) Q) N8 o
//速度(1-10)
5 i# G( d( [! ]/ r. R: G+ |var marqueespeed=3
/ J: s4 {( D1 c//背景颜色) r6 U+ S' i$ l
var marqueebgcolor="#FFFFFF"; P7 M1 G0 q0 |' ~, d$ v
//是否能暂停 (0=no. 1=yes)?6 f8 L2 _% q. b1 c9 V8 x
var pauseit=1" `( Q8 c" q, m7 B! p

* H; F& ~% Q" t% M7 W. {# r//修改显示内容
' I  q5 o. S3 ~; K0 i& Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 k, c: |" T. h; e" B5 L6 Y6 M8 {8 I6 b

+ _- n$ Z, B4 L1 [- Y/ G& \////下面不需改变////////////$ m: o  y4 z8 P* }& }

7 X& L( ?7 i. \- W) |  lvar copyspeed=marqueespeed
  ^+ u3 y4 E  i( Y$ wvar pausespeed=(pauseit==0)? copyspeed: 0% N: R3 S2 M3 n7 I% t% o7 d
var iedom=document.all||document.getElementById
3 [$ o" z; s: @* b9 o0 Z, tif (iedom)
% g( M- S& {6 |, Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 i( x6 ?* P. m+ A6 Fvar actualwidth=''
% T8 g, q, l: Dvar cross_marquee, ns_marquee# K" V* t6 P) i; P

4 [) y9 ^& P: ?* Q8 zfunction populate(){
- G" ~- B# e. X* Bif (iedom){
, D4 N& Z* P/ m2 s( v8 vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  ]0 \0 j; Y* g( E2 p! n; {' vcross_marquee.style.left=marqueewidth+8
4 g+ }2 r; E* s4 W7 zcross_marquee.innerHTML=marqueecontent% [6 K, Q: |# _% u) b7 C8 u+ ~( v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ y) O9 Z' |) U& ^* o# X, d4 O0 Y}
# r( a& @! ?6 [% [else if (document.layers){; ~3 B7 {1 h; v/ B+ {/ r
ns_marquee=document.ns_marquee.document.ns_marquee26 O  n, `# `- j% i4 ^' @
ns_marquee.left=marqueewidth+87 z; y' N. K/ P# ?7 r5 z
ns_marquee.document.write(marqueecontent)
! s; Z, Q: L* A8 V0 H# q( f+ [, J& Mns_marquee.document.close()
3 p& B2 O( B9 D8 Cactualwidth=ns_marquee.document.width
1 P& f6 E; ?2 d: R% y$ w7 }' h) e}
- T# V! B$ N$ nlefttime=setInterval("scrollmarquee()",20)
% \/ J3 t1 P6 j' `}
4 U: H/ ~& |1 }: P$ e, ?8 Nwindow.onload=populate
" [+ Y  w2 N) r+ N0 J! e4 N, H" f8 `7 o; `# p3 S: Z4 ?0 M1 u
function scrollmarquee(){
9 X' ]/ \' w0 J5 h+ c3 C3 lif (iedom){
2 q7 o$ M  z0 n; Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 l  K4 [$ g! ?8 U, P4 f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( z8 t! t& D; O" x& a
else  ~( J5 d' H3 b7 N" F- g% s
cross_marquee.style.left=marqueewidth+8: r4 |7 b0 n, `& C' l- f9 U
  e% S% U* a. N2 v+ l6 ?+ c7 W
}) m+ a( E: s- z9 V
else if (document.layers){
# Y4 [2 r% s8 a0 ~$ lif (ns_marquee.left>(actualwidth*(-1)+8)). J) k6 _$ u0 |
ns_marquee.left-=copyspeed
6 d5 c2 {+ m) d: u  u9 uelse
5 x2 C; H- S1 K5 Z0 H. H7 r5 x7 ?: Rns_marquee.left=marqueewidth+8
% V& u; q0 u; @- k2 E3 ]2 M0 W$ G}
& Z0 _% Q  a/ T* R/ a}
1 J" ]+ L# o3 ?) p
$ K& u( T2 g6 r. wif (iedom||document.layers){& C, _4 s, ^  N/ j
with (document){7 B1 o/ Y- V( @7 }  c* `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 M- H  e1 }4 a  vif (iedom){, }6 ]: n6 L9 k$ A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# m% a5 w6 T. Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" t( X0 v# }: R! T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# k$ n: @& V: H$ }5 Xwrite('</div>')
+ o& d# B6 P; Y1 @' f1 V2 v$ C7 c" i}
: W7 E# t9 b0 s$ J2 U+ Yelse if (document.layers){
# c: k4 b& Y* bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), x/ \% ^& p5 d2 `# }7 C1 k. @( `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ E7 @# c" r- ?1 {. Kwrite('</ilayer>'), A  N6 [  A( q5 K) k
}  U5 f" E: z8 S; p
document.write('</td></table>')
6 \; A# w5 P0 a7 K' O) E  X2 O, [}1 W& f; ?7 g" ?8 I  }3 m2 O
}
0 j6 z- L% l3 i' u* {. @</script>

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