返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# ?) I( D# [5 ]0 E' {' E7 E  T: kvar marqueewidth=300
# p& h) T. `5 B//高度
$ k5 j* O- t# s7 C( n" e0 zvar marqueeheight=255 o- A& X1 O; u+ l# \
//速度(1-10)
* B/ [* [; |4 p! y; R/ ?% Hvar marqueespeed=35 W  l, C3 E% ~( e0 M" \
//背景颜色
+ n3 h' d5 ?( P/ f2 Tvar marqueebgcolor="#FFFFFF"
7 Q/ |# z; U6 W) r7 Z* t/ i//是否能暂停 (0=no. 1=yes)?4 ^7 `/ |* i2 z' \* d
var pauseit=1
- g- s7 X4 N- n7 D$ o9 `
4 b/ P5 o4 n) |//修改显示内容; v! I: @; Y. }7 e  d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! p5 ^: }8 C7 l, l. o2 c/ I0 v. M1 C- E* W1 o+ R1 U- P

8 Y, A$ X: h; e% o  K+ S: G3 ^9 t. G////下面不需改变////////////8 ^* G. i0 s& |( F; H1 w
4 Z* l1 Z7 t, H2 r. k
var copyspeed=marqueespeed
8 N2 o7 [5 L8 m! H9 ^" {+ d  }var pausespeed=(pauseit==0)? copyspeed: 0
# w4 H" P4 o0 q& y- w2 |4 Rvar iedom=document.all||document.getElementById* I$ d; Z( o, L& f
if (iedom)  y& M- g5 l/ z  K# D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ O% i  x4 A( s8 W+ r
var actualwidth=''( z1 M) B) o# X+ t  x
var cross_marquee, ns_marquee
% i( t" ?6 n/ h5 I5 b2 G
& E0 e# k; n  Zfunction populate(){
7 D' t* I( B6 h& ]( vif (iedom){
4 K& \, T4 D( c) \# m( r% o% \" vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 H% ~7 z8 c% f
cross_marquee.style.left=marqueewidth+8
3 R- V& j  G, B5 H) T* p5 n+ Y( Bcross_marquee.innerHTML=marqueecontent
2 r; \' J: p5 u3 K' ^$ R& z9 factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& x0 o7 L6 r+ F}/ B1 S1 E( g+ l7 M. b
else if (document.layers){! u' H* I" K9 a1 i5 A5 G0 j
ns_marquee=document.ns_marquee.document.ns_marquee2* l; w, d& M7 _, L
ns_marquee.left=marqueewidth+8
" `, C5 K2 W6 B4 V) m  C" Ans_marquee.document.write(marqueecontent)
8 d6 u0 w/ N4 S) U; g7 G! H- M/ ]ns_marquee.document.close()2 R* O1 M3 S2 K! D7 [4 k
actualwidth=ns_marquee.document.width( |9 ^# \7 }* Y3 `' x
}  v& @: H! e+ U  z  K7 K
lefttime=setInterval("scrollmarquee()",20)
. V( m0 t3 v" z}& n$ N. q: U& i5 s
window.onload=populate
: p9 A: _9 _) d7 b" U: x) a
, O; Z) Z9 G5 i/ C: ^. _0 ufunction scrollmarquee(){
" g: o4 z+ p! w9 w+ Qif (iedom){$ I  y" c9 S+ o0 a& @9 N1 n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 J7 O& O2 R3 D: N5 Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 v0 u) d( X9 O* V
else
+ g! {- t! P7 w/ D, {" [cross_marquee.style.left=marqueewidth+8) S( R& ~. k! Q' K, ?" v. K

+ s% p8 Y- w0 h+ Y: B, _# B}: [3 z  R( v/ E5 c+ S
else if (document.layers){8 A, A  u- C% ~7 k/ Z9 I
if (ns_marquee.left>(actualwidth*(-1)+8))5 ~' z- ?& ~, m
ns_marquee.left-=copyspeed
& p8 j4 i  a: zelse
! p4 Q/ s2 N; ^2 Lns_marquee.left=marqueewidth+8" h8 S  t: e7 e. }- U
}" I% N$ l& `: |
}' z7 J2 H. P9 p1 @: P5 j+ A7 l5 p# D9 T

" D5 S4 o6 s! @% F9 _! `9 Kif (iedom||document.layers){/ Y( a4 @: l( a$ X: k
with (document){6 B% |# B5 L! z, I3 b; n" J3 N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); P1 x0 b2 H7 ^9 [
if (iedom){
/ Q" w: q: V& p/ bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ e6 b5 C; n' d8 C& a, U0 @$ e9 Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! |! m0 z  B& R- b' m, v4 nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( ~. d. ?+ k# j7 ?write('</div>')
- }3 {3 P% j2 F* {* b, {}! w" l+ s8 ?  a' N" e8 J! F0 m
else if (document.layers){! z: @( D- \! s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- S* s. D) |# i2 ?1 H  T( P. l6 nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% m2 Q' y  E; v( L5 j2 C
write('</ilayer>')+ S5 k8 w1 }, o3 N7 D# W# U. B
}1 P3 T  {6 @( n
document.write('</td></table>')
7 W9 z+ W+ n$ X' ~5 z9 V}
' Z( W; R2 n& {}
/ h' |; z/ M6 M7 o6 C6 {</script>

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