返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% |& Y/ v( ?$ c$ @4 wvar marqueewidth=3004 `% S( M( f1 V' ~" S+ X  n' b
//高度
7 G' l' L0 V4 `$ r9 v1 Rvar marqueeheight=25- P* t; A) W/ T7 p& l+ b
//速度(1-10)
! O( b: N7 u8 R! R6 Q. b. Jvar marqueespeed=32 g# Z5 b  e; E! _4 ]
//背景颜色
9 l; _2 ^* o% B4 E( a& Svar marqueebgcolor="#FFFFFF": a- F9 n- m* E
//是否能暂停 (0=no. 1=yes)?( Q% a" X! x2 W& k
var pauseit=1) H! x' _% C) j3 H" O7 z3 P2 ^

  H3 ~" K3 r( G, Z) w//修改显示内容
" R8 {# V' n! [! Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: C5 I$ X$ z4 c$ Z7 y) v% w! d0 \

! X! a& _  ^9 V# `9 h6 H////下面不需改变////////////" g3 Y$ \% \5 g) m% h% A8 K0 }
! q2 x; C, }5 S9 }" n
var copyspeed=marqueespeed
, p, P( t/ i. j1 H; p. }: k# Tvar pausespeed=(pauseit==0)? copyspeed: 0$ F: X9 H! W% E
var iedom=document.all||document.getElementById+ }  J3 N: \4 U4 q
if (iedom)6 ?# \+ r. r: n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 U- J7 g3 N$ L9 P* l3 R. z
var actualwidth=''
. q9 U7 k5 J. Cvar cross_marquee, ns_marquee* F2 ]# q" Q# _0 k, H- I- g

9 D! @* I- R0 s  Y, \2 r8 dfunction populate(){
& R- p- o9 K$ m2 \  v) ~% z- u$ _if (iedom){
' A) k. q. C( o5 C) e7 f* wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 m' u1 S+ U) h  C
cross_marquee.style.left=marqueewidth+8
) ]8 s7 j) x# \8 [1 Gcross_marquee.innerHTML=marqueecontent  u8 w# Q% e9 U3 S4 y7 p, q) ~5 _, L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 h/ d! p& C( J6 w/ w1 w
}
1 n+ V4 k/ n- n8 y  V2 \7 Helse if (document.layers){$ A9 d& e6 w) p2 m) a0 ?' B
ns_marquee=document.ns_marquee.document.ns_marquee2
; |. A4 _0 }% ?! `) I* wns_marquee.left=marqueewidth+8, g# Q+ q: v# F/ O$ n- ?
ns_marquee.document.write(marqueecontent)
) u3 c- G6 \& P* Cns_marquee.document.close()/ V9 k* c. ~0 ~
actualwidth=ns_marquee.document.width( b4 b) ~8 W5 u* ^
}- a# U  u; @) c8 b, O
lefttime=setInterval("scrollmarquee()",20)
! K* L  z$ G: g}* E* ~0 g' F* m, U
window.onload=populate
+ V3 E- i8 K1 n7 |# u% w- f9 o/ b
- H0 ?4 `3 h! K- I+ h1 L1 ]function scrollmarquee(){
: O! v& z* Q& s& wif (iedom){
5 e9 t9 C( v& e  Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) Q6 n! `5 ~8 D( v8 ?1 ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 q4 }" H9 s+ \; ~* L8 S0 Y
else6 m4 @* ]. w) Z% X6 [# x
cross_marquee.style.left=marqueewidth+8; |2 C6 }6 |! r+ T

8 y! p6 M) {2 `}
3 r+ T( }5 p- w, ~$ Uelse if (document.layers){6 v+ F9 T$ o1 z2 @, g! R
if (ns_marquee.left>(actualwidth*(-1)+8))
/ \( E# g' _7 z  o+ vns_marquee.left-=copyspeed
7 G1 j/ A' I$ @else
6 ^8 o7 I; t$ J! Wns_marquee.left=marqueewidth+8
3 Z( B  _% b' _) P6 q8 t}+ N* Y" l$ u' q8 k: ^: `& n$ e& U
}+ P2 C+ o  _3 J1 d6 Z7 h
* C) ^" Y. R+ H# [% T6 h( y
if (iedom||document.layers){
* e: m/ x. m$ T6 J' }; lwith (document){
4 G- M9 d) T, z, \$ D5 b& r6 Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 h' C+ _; x. W7 t+ V" c0 Z* Iif (iedom){
7 w$ z8 }. J( Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 T9 e( Y& L9 f! j5 F# y7 rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 h1 x+ b, J5 }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 N( a% j5 Q6 qwrite('</div>')0 R; s5 K. {3 `' u: V8 L4 P9 X' _: c
}: j8 K, T" V* t/ z5 s
else if (document.layers){5 A, _" P4 k$ H+ B  i8 Z9 g) J, s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( A  A2 s" i: k3 Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 ~/ l/ g7 F9 N& i. U' w6 q
write('</ilayer>')7 u( K( ~' ~% h7 E
}
' I) ]9 o6 Q. `7 \% ldocument.write('</td></table>')  v2 [: J2 D- {% J* T
}( q2 Q9 ?9 ?3 ^& h/ u' \
}- ]" ~1 ^3 X! t3 n5 i) B
</script>

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