返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" x; T: L* V, y' H& D+ wvar marqueewidth=3004 e; t; ~( i  e9 N
//高度
& t6 s/ }4 e- kvar marqueeheight=25- _* N' x7 ~8 y( c9 K
//速度(1-10)6 W1 `2 Y+ g* `* K' _4 F! z
var marqueespeed=3! [5 I" Y# Y& ?! b
//背景颜色/ F! w7 C0 W! K/ E+ x6 ]$ B
var marqueebgcolor="#FFFFFF"2 ~( ~- X' |3 c9 m. J3 d
//是否能暂停 (0=no. 1=yes)?
+ ]7 t$ N  r8 Ovar pauseit=1' ^) A( A$ _1 L- c7 R, e, G
# d+ l) V- ~" H% q
//修改显示内容
3 o$ X4 K" Q- u5 [: cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ J0 C0 r/ b( a, N5 Q& V
, R% g, F3 Y# M4 E2 m6 \( c5 F: f$ ]3 w4 S0 C
////下面不需改变////////////
" X1 y$ |1 u& y) [9 y6 }/ Y
* W: ~+ X# }; \# K; M- ^var copyspeed=marqueespeed7 @  r0 ~+ e1 q0 P) a. z
var pausespeed=(pauseit==0)? copyspeed: 0( m9 L( E4 a* t  D' v" G
var iedom=document.all||document.getElementById/ U, U. Z% p" H1 N- C! B
if (iedom)
: t) w3 ?  ?# E1 {# K! F: kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 }$ x  L. R# s& F5 a3 Z* Rvar actualwidth=''0 Y9 L/ C) J( Q- p5 D
var cross_marquee, ns_marquee
% @+ X, X$ \  m& K7 E3 s0 m* F
% @6 I* c- @6 ^% q8 R+ cfunction populate(){
* p& X3 v- t8 r& h+ ?if (iedom){# W" i, l8 V/ v+ h1 G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 g9 k, I/ Y  q3 V& M
cross_marquee.style.left=marqueewidth+8
6 _' `$ b( I/ p# v- w9 Icross_marquee.innerHTML=marqueecontent
5 C9 g2 V9 `) }2 X4 h4 Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. T- Z  t5 Z* b/ a7 Q& P
}
- ]7 K1 y: ]6 D  velse if (document.layers){7 Z  _3 y/ e$ }0 R9 x, e
ns_marquee=document.ns_marquee.document.ns_marquee2
" M% Y9 [# K8 j- z: }ns_marquee.left=marqueewidth+81 v3 U$ S0 ]! P0 Y" F
ns_marquee.document.write(marqueecontent)
, A4 X, H5 Q7 }( U8 zns_marquee.document.close()
! W5 v1 p& ~- G$ Cactualwidth=ns_marquee.document.width
2 O4 a& ~* }$ `: m4 |}9 v6 S/ S! z- ~/ D& Y
lefttime=setInterval("scrollmarquee()",20)/ U4 o2 Y6 f6 f# i8 P2 @
}4 y4 ~4 A+ E8 z( O5 k
window.onload=populate5 I; x7 i: r: F# o+ l% w

" b& [' H* {' s- w! }: {$ `function scrollmarquee(){, {2 n: o3 u' D- `3 }. _5 Y; w1 E5 @& g
if (iedom){/ H2 e6 ^; F7 C2 W! d( t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 ~% \, O3 C$ I3 P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( R1 v/ }$ w9 A8 p8 ^( jelse
' a* H4 J: o/ {cross_marquee.style.left=marqueewidth+8* f7 O% U7 c3 @% Q7 Y. m/ A, R% J

* l5 |+ I. l+ F' i+ g# g+ C}
4 Y5 w: G' c3 T$ B4 zelse if (document.layers){' R. r# g! O* r0 C, Z. S* a
if (ns_marquee.left>(actualwidth*(-1)+8))5 ~$ S# B+ Z, h. `, D! ^
ns_marquee.left-=copyspeed
; i( ?' Y5 @% z+ Z: z- jelse
4 C4 ]8 H8 A/ U4 nns_marquee.left=marqueewidth+8' H$ G9 o, [1 R5 |& O
}
+ ^8 b- t5 h/ w& a}
( `8 B2 E/ k1 W& w2 Y, J) j+ {, o0 i  z* l! I) e
if (iedom||document.layers){. Y, X  v* P+ ^8 J
with (document){7 Q7 W) E  C" g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 h0 D4 H# I: H. |# J' _0 n. tif (iedom){
0 F2 c+ O7 d6 C* `# Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 d. ]/ k0 |: ?4 @3 gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: L! Y! `, [$ C2 Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" F) `0 G4 ?/ a& dwrite('</div>')
5 F# R6 t& S, T; i( J8 w}
! t" w2 ?' E( v; N% w* Ielse if (document.layers){
; Q. G9 p& c0 @' Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 F# b: K1 P( O6 {+ Y6 ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ C3 z/ X* r; }: b, @8 w
write('</ilayer>')
5 p3 {& ]) ^$ m8 {+ x}
- d# N& y: C* l4 z  odocument.write('</td></table>')( d! _2 z/ g2 e0 G
}3 q& F$ Y- }6 f# z: L$ A
}
" ^1 N$ m) e0 X" H</script>

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