返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 a7 v- [$ P# A4 _8 W, E1 M& W# bvar marqueewidth=3004 a2 \/ `& k7 v6 K5 O# g
//高度
$ O& I9 [3 q% [) uvar marqueeheight=250 \% T$ |9 P5 {% T; k
//速度(1-10)
2 s8 L! p$ k1 i  E% q1 N0 Lvar marqueespeed=3- B: S- v/ a* S2 x
//背景颜色
4 d9 g/ ^' Y$ S  f; H5 zvar marqueebgcolor="#FFFFFF"
; ]% O+ Y. E8 E& M- n, f6 I0 d//是否能暂停 (0=no. 1=yes)?
7 r' l# D' I8 r+ s3 u* F7 Qvar pauseit=1# `3 {2 X9 U. Z! E+ A* z

2 J4 b5 n& @" c4 b. O4 g//修改显示内容
' K" j& I- B! ^; i  Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" t+ S5 K- L1 O; n( g/ R* {6 V9 S( N% `) Y
2 u& `# B" ?# t" k9 }
////下面不需改变////////////
( f! W: F+ r# w; v1 l, J+ y
5 b, A, W+ V* u$ tvar copyspeed=marqueespeed
% F0 H8 }3 a3 v& T* fvar pausespeed=(pauseit==0)? copyspeed: 0/ Z0 K* N! e6 {7 e" r2 ?# n
var iedom=document.all||document.getElementById2 s  c" \- }5 i( l- q# B) `8 ?
if (iedom)! @3 E$ y$ h8 T& `- ^" G$ ?
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# J6 e. T3 {7 U" |/ b) hvar actualwidth=''
( G; Q& R" @' N4 ]var cross_marquee, ns_marquee
1 R6 w' o" J% e, h' t& E! h
% i( x! `: d8 |* f4 R/ I! Z& wfunction populate(){( }2 m* n$ K& j( o  L% \
if (iedom){
7 z/ E4 L  K4 @! n, Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- v  U6 P! b0 R0 [+ i
cross_marquee.style.left=marqueewidth+87 x5 A4 k% c" t8 o9 O4 [, q; r
cross_marquee.innerHTML=marqueecontent
; W4 Y& \4 ]8 W/ O& P8 ~( @) P: Qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! |' n7 Y5 f, @7 r: l% I1 u
}
! J7 p" s0 X9 |( D+ `4 f# Oelse if (document.layers){0 Q" P1 n' c- ~3 O
ns_marquee=document.ns_marquee.document.ns_marquee2* R' T9 H; m4 d# H7 Q! a
ns_marquee.left=marqueewidth+8$ d. O3 f  d2 G" w4 H  o5 c
ns_marquee.document.write(marqueecontent)
1 t1 w. q/ b. Wns_marquee.document.close()
# `( N% l3 R" s3 s- S6 vactualwidth=ns_marquee.document.width/ M( ^/ L. r7 v! u" u5 D2 r) G
}
% [* N' t3 w6 P7 Jlefttime=setInterval("scrollmarquee()",20)% V+ M6 J) O% s& g. x, o( S: N0 ?
}" ~( e' v- D2 u( G6 E& H9 g
window.onload=populate
/ n( H5 x( x9 |5 ~! v/ E' C/ Q0 ^! |& t4 h
function scrollmarquee(){
6 n  ]; k! a% X( mif (iedom){1 K' k2 r( q2 J) y# H  h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! t4 a* r+ n% k  qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) H& l) O0 Y$ ^' x2 |else
$ s5 }. O0 o. g) k! tcross_marquee.style.left=marqueewidth+8! J, V. b) Q; h

  p6 `: W) b- @/ n$ b}8 i0 Z3 v. h8 W2 q. N0 {  w2 M
else if (document.layers){
9 D+ g. h+ |" \9 x; ^; z% ]if (ns_marquee.left>(actualwidth*(-1)+8))! U  O% L. H5 C9 }! L
ns_marquee.left-=copyspeed$ Q8 r! ^5 B4 U0 I0 T" t
else
* p: ~% `; ~7 P& y8 vns_marquee.left=marqueewidth+8% ]3 B$ y4 A9 N/ ^& R
}/ W' d! S6 G' W1 ]
}/ v6 s4 a6 S6 E' J2 c

% `3 z' g# I5 w3 Lif (iedom||document.layers){/ z! K, D4 T+ S
with (document){  Y+ f3 b7 J4 {  _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 N  P$ d$ `% c4 O! k. f
if (iedom){
1 z3 F) P+ X$ y. y/ ~: `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 X/ @. l7 g: v2 |# X% [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 ?5 M; e4 ^) _: H. L! M# fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 k% L) \$ o8 d7 Owrite('</div>')) P9 b% G* r  t: k
}
5 K6 v7 A  Q  |0 {  }else if (document.layers){8 f  O7 L9 y6 \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ k2 `. k5 c+ i, Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# o! p7 @0 z* W  `( k# uwrite('</ilayer>')7 F+ N4 B  P" X) ?) k: u5 S$ Z- R
}+ y+ W# O" g) v6 u5 {* r
document.write('</td></table>')1 s/ i7 Q' \, B, C0 F6 j) J
}. |8 h" ]2 h) @( C. `
}
; \3 _! @# m2 u: u</script>

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