返回列表 发帖

网页之跑马灯文字特效

//修改宽度: ?+ T; c- G7 g; d- \: |
var marqueewidth=300. ~. s5 t* L8 {# l$ v
//高度8 N8 m5 R8 N0 u0 {" v$ E
var marqueeheight=25
7 L9 ?7 E8 V# Y5 i//速度(1-10)/ z9 i% X2 ~, y6 X- Q7 |: {5 K' g
var marqueespeed=3
& I) S. @; K4 }' C4 _: X0 \: d//背景颜色1 W0 j* B! @; \8 }) H, S
var marqueebgcolor="#FFFFFF"
' _  l5 I3 o# v( o: \: |" L1 u//是否能暂停 (0=no. 1=yes)?# a. `, J9 ]! w! t9 C, v. L
var pauseit=1
# b+ H/ |( k  t. T; q2 m8 v; ]# ?2 B
//修改显示内容
$ r& x. g/ t5 h. [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( P/ o5 Z1 c" a. v

" `1 n0 A$ `  X; @! U3 S- P$ J- E4 ^" t) j& b& v) W
////下面不需改变////////////
" B: q; K. V8 i4 X" l# c
% d! W' e4 X; O% L7 S+ g- m5 Ovar copyspeed=marqueespeed
2 N0 o+ `( Z. C0 H  ~# }& Pvar pausespeed=(pauseit==0)? copyspeed: 0/ Q; N0 G& n# ]  a# j! t0 n" a
var iedom=document.all||document.getElementById
# J8 \+ Y4 B; J1 P! }if (iedom)
) ?' X4 v& M9 c+ v* Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  B% S( K1 {2 J; a+ mvar actualwidth=''
( @: Q4 k* H: K  w' ?8 ivar cross_marquee, ns_marquee% l6 g- Z) O# b' k

# a* S# p3 P, x; a. Yfunction populate(){6 N6 `; C6 x& {4 x1 s
if (iedom){
8 I& l( X- {+ f: k% [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 F- x7 I- H) c! h* u; j
cross_marquee.style.left=marqueewidth+8
5 y! B6 m- f( Dcross_marquee.innerHTML=marqueecontent/ c! s  _, w0 {8 A) v, v7 W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 T( s! S3 p6 E* h}* }% ?& l* i: \  f) S
else if (document.layers){; Z: g. |6 p. F! Y7 c: v
ns_marquee=document.ns_marquee.document.ns_marquee2- Y! d2 l2 c' A$ i; C
ns_marquee.left=marqueewidth+8# [; v, W+ _+ v
ns_marquee.document.write(marqueecontent)  \; r0 y# @7 Z& ]$ b  o: ]  J- S+ X
ns_marquee.document.close(), `7 d6 J5 M% T+ W: p
actualwidth=ns_marquee.document.width* W5 `7 z/ p3 h; k3 J! n& R
}- P/ R1 T$ k, x( ^
lefttime=setInterval("scrollmarquee()",20)
( d: T) r7 F# Z}" B+ x( f, w  Y5 U* L% }5 u
window.onload=populate
3 L, g/ Y5 h9 H- ]/ p9 W; R" ?' k. D# Z. w! Q1 R
function scrollmarquee(){
" ^- V3 a$ \8 d9 D2 w$ X( `( b* `if (iedom){
  ^5 i( Z6 K" @5 Q( L4 ?( [4 Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). r0 L: N0 D2 r3 f0 L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 _6 y4 x, R1 o. r
else
) C7 Y& _* F: l+ g4 y5 o7 L/ e3 z) @/ U# wcross_marquee.style.left=marqueewidth+8
8 D# H! L% p+ n* ~; |8 O+ K( p2 [
# j3 L; E4 H6 S4 z; E}1 @, F% \( R: |! e5 Q3 V# `/ T, q& r
else if (document.layers){' ]6 p$ r  H0 s+ x$ F
if (ns_marquee.left>(actualwidth*(-1)+8))% I! \; E9 |! I" K6 i
ns_marquee.left-=copyspeed" @$ Y, @' I( J# `0 V: Y7 x
else: h3 J* j# n6 \
ns_marquee.left=marqueewidth+87 ?* p. X) r* L0 @% Z
}
; F3 N8 \- k, S2 U: }$ o}
$ {; P9 v/ m, j2 b" W
, {/ k( T0 \* R: rif (iedom||document.layers){- V  Q- U; ]  L+ O9 q& b; q
with (document){
1 o6 i# D1 F. S, G% U$ d: G9 ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; K4 z/ A  F# w3 w. D6 D# Zif (iedom){9 y3 ~/ E4 F. U$ ]" T  F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): B5 H: m; l. ]5 h/ s9 P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 N! d- B7 y' D3 x: x+ ~6 n9 h% Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ R7 z) D( u7 U6 u0 Qwrite('</div>')
) ]8 W2 U3 B( u# X}
. D7 X9 |! f2 d2 G; d  ~, ^3 qelse if (document.layers){( W- F2 `- S" C, V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, ^' t: Y# G( Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 h) o! a' m, |1 Z% ?8 D" M
write('</ilayer>')9 |, f* _! P+ P2 D5 U7 U, E4 x
}
4 u3 y8 w8 H" L2 kdocument.write('</td></table>')
+ \: D8 U/ ^; i: t- b}# ?' ^& K0 {0 t
}
5 u. y- I% Y% R</script>

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