返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: q* I- r/ z- s2 \* @2 q: zvar marqueewidth=3007 x# D6 C4 I( b0 I+ L& h
//高度
9 V1 R. Q1 P* m) p) o2 b$ l% Zvar marqueeheight=25
& h/ `$ x, V; h' m( L2 r4 G//速度(1-10), H1 g8 }7 A# ~8 d
var marqueespeed=35 k- m1 R! t* K7 ?
//背景颜色
7 s' m6 p# i8 D0 |* ?3 }var marqueebgcolor="#FFFFFF"% Q, _2 w4 k; {  ^% t) c
//是否能暂停 (0=no. 1=yes)?. ~4 g: X& J9 C2 q9 l
var pauseit=1
% {$ }8 u9 W* V" w8 T4 H+ Z  ]" o% d( v* V
//修改显示内容
- ~0 i( ~) N0 |$ L0 ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; E! K+ b# n6 U9 q: G, ?
4 B7 A/ I5 {$ k5 n3 \7 |

# ^2 H2 ?7 [) G  _( w////下面不需改变////////////% U  O; m0 w7 [/ z: F( v
" N% o7 H% b, m, ?7 J# \
var copyspeed=marqueespeed
! v3 m7 ^- e, a+ \! mvar pausespeed=(pauseit==0)? copyspeed: 0; u/ t6 A) c4 [: R4 r' X) v
var iedom=document.all||document.getElementById7 E4 L: M( F# ?5 k" i
if (iedom)
! p% G' Z0 }; E. s; H& @0 U" \/ x4 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! o; j# |1 i# w* cvar actualwidth=''
8 N2 a* v+ Q* R( s' A" Dvar cross_marquee, ns_marquee; v3 I* J0 m) r/ {0 ^/ f

3 s; v, |) w" X- \  ?  T; _function populate(){# B. H3 ~) E2 E  k
if (iedom){; {% r) a) V0 g2 u+ p/ I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 f: y; c5 ]! U, I" Jcross_marquee.style.left=marqueewidth+8
# C1 y6 b+ e5 L1 vcross_marquee.innerHTML=marqueecontent5 @7 p9 G7 ^- C% r7 ~" t5 K3 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. B$ g7 W3 g" a" ]1 R0 q}
9 d( f0 ^1 j# y5 e5 Qelse if (document.layers){
+ O6 G! q0 M1 H* g& Xns_marquee=document.ns_marquee.document.ns_marquee2( F0 D5 i+ \5 W! H; Q7 {, ^
ns_marquee.left=marqueewidth+8
" D, d# j8 L8 {, w* g$ S5 nns_marquee.document.write(marqueecontent)
- n$ i2 x+ m! ?: o( ~. i* Wns_marquee.document.close()
5 S& s: H/ z0 A& n" @/ N" Sactualwidth=ns_marquee.document.width
1 D+ F1 T3 `% W9 K6 k* O! _- M: X- Q}- p) }7 ~% Z1 O( y( j$ x' P
lefttime=setInterval("scrollmarquee()",20)
  f+ N! O" Z9 Z+ O( t}9 W, e' V: p& B  k9 Z
window.onload=populate
' N( E6 A: t6 l2 x; ]9 y% m: H
- g8 E, u0 g6 p# g$ Ifunction scrollmarquee(){
; H/ ?8 F7 `* g. j8 O; ^. c- Rif (iedom){) N! f8 k9 v: j7 ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 r/ \- o/ I( U1 ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! o2 |+ a6 i8 i/ c2 w  {' s
else4 \; R, @+ _' H% T, G3 a+ b
cross_marquee.style.left=marqueewidth+8
. R0 ~/ j( B* n( L
( l: n" r7 K2 {2 o* ^* s" f- }6 p}
% I8 z2 Q! _$ H! }: C7 Z, ?# }0 Z4 relse if (document.layers){3 g& E# z$ p5 ]
if (ns_marquee.left>(actualwidth*(-1)+8))! g7 o* B& q5 U& o4 S6 j- O% @
ns_marquee.left-=copyspeed
' k& h$ R& u8 g: c: B" W5 J, Yelse+ Y1 q6 f9 Z" _4 q( C' ^
ns_marquee.left=marqueewidth+87 Q9 b7 O9 N& f
}
( X) [1 H% k% c( o8 \( L/ K}
* s8 J$ @6 B3 v- Y5 b+ \" P  M+ e6 ^: l7 D8 Q7 e
if (iedom||document.layers){7 U& F! S$ o# B9 d: P2 V" Z
with (document){3 p8 \- o. o: O9 ]: g9 w% M% J+ V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 t0 G5 M3 N6 B) g/ O8 d7 X
if (iedom){8 w, q' s- P# [; H- P3 s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& Z0 p) [, ?8 e" p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) M& ?& W0 P. W$ i' ?' }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' i7 O7 j% V+ v- D5 Awrite('</div>')
& M- [: s8 T- W' D; }; G1 i}6 @! H9 E& ?: r4 {  i3 `& S5 W
else if (document.layers){+ e% D' d& c6 V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 M0 i3 @2 Q  J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) g2 A/ [  z' e
write('</ilayer>')5 S, C& L% x3 v" E2 i1 w# B- {
}
+ w: }  V) c5 N7 Adocument.write('</td></table>')' m; T+ }9 m7 X) b' v; A
}
7 ?; ?- F6 A# F; q# a6 n2 t% `}
$ y' x3 d$ h' c2 `8 d</script>

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