返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 V1 _& [: z( M3 s* h
var marqueewidth=3004 n0 w$ E' {* _' k3 {1 H& z3 c! f& g
//高度
. V( @: ]" \2 ~! _8 _var marqueeheight=253 G3 I% Q  a* P& |% l6 P- d
//速度(1-10)
% ~" w; Y- X& Z4 Evar marqueespeed=3
& a5 r3 C; P" `//背景颜色) p5 {5 u% V+ e( U; r9 I: P
var marqueebgcolor="#FFFFFF"
0 r* E: m; ?7 `/ \& a//是否能暂停 (0=no. 1=yes)?
5 ~# h8 G; H" N" |1 Kvar pauseit=1
; q6 n( ?5 k) B  B3 g8 Y( l( n
- c/ J& \- S9 j6 w; T9 ?; F//修改显示内容2 P  o! l# }3 H, W  l1 G( s4 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 {/ o+ }/ X- B7 B. @! G
) R( c0 D' _! g4 w# F' L( c; \2 }+ W- H1 O6 l/ s
////下面不需改变////////////
/ I; q8 M9 _2 }. s4 Y2 {3 L; i1 M$ C6 [. @5 k) J  y
var copyspeed=marqueespeed
7 j+ `9 Y0 D. u# r; C( O0 c3 lvar pausespeed=(pauseit==0)? copyspeed: 05 F% x7 a* V$ ?1 {. j6 H9 j
var iedom=document.all||document.getElementById
# E# Y9 f% v! z' A* @+ Pif (iedom). B. w, A5 r( y8 p) b6 {* U4 @7 ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 B7 V6 _* E. R$ W8 z5 s. y$ s
var actualwidth=''
4 M3 x2 P+ F  ^/ k/ Tvar cross_marquee, ns_marquee9 O% b- }; J/ J, {3 C

) U% ]/ D- f2 c& ?5 E* @function populate(){
3 m/ C. r# ~, b$ ~0 Xif (iedom){; k" u/ ~# p+ w+ {% ^! [% s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, Z' d5 d( P5 W* \8 `! V, n- q7 t
cross_marquee.style.left=marqueewidth+8
8 U' g0 `# \$ j+ k9 _" @cross_marquee.innerHTML=marqueecontent9 e  F8 q" A0 x+ O: k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* Q. [; |- `% y4 A* K5 |9 J2 b
}- K/ f7 W9 q6 R4 w& x, V
else if (document.layers){" e! Y- i- G% F8 `: O
ns_marquee=document.ns_marquee.document.ns_marquee2+ t+ q& ]* Z& M' g
ns_marquee.left=marqueewidth+82 |8 u7 m$ o( w" T* P, X0 q
ns_marquee.document.write(marqueecontent)
) H5 @# |; X3 Q; ^$ M2 Lns_marquee.document.close()$ x0 t; c! K: `2 j
actualwidth=ns_marquee.document.width0 U1 x( L" ~3 g* G! q
}& [, i# ?# t2 X( [& ~9 K
lefttime=setInterval("scrollmarquee()",20)# M) ?, W& o- a3 o( K+ m
}
% }. ^. N* S2 ?& |window.onload=populate6 |4 J, l% t. e
5 m; d3 ~! O5 w6 F8 m& d* _
function scrollmarquee(){: _5 `7 M+ T! J6 `* W
if (iedom){3 r4 ^6 Q  f+ u1 o
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& q% W1 K; L/ w$ J6 `4 ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ h; U2 G! x  R+ `
else7 c) h1 e# t/ b1 T0 s. [+ V- }1 X
cross_marquee.style.left=marqueewidth+89 v% X8 i5 s. y' a, N
( f0 s6 t- {& f8 z% s7 _
}; e, }1 @, m) \
else if (document.layers){' z9 b+ O% r* s4 h  @# k& P
if (ns_marquee.left>(actualwidth*(-1)+8))
, }5 P8 n$ e& r+ ins_marquee.left-=copyspeed. d- s' q" ~( S. p3 b0 |9 ]2 {
else
1 T) w/ x, S5 F/ ~2 ?% l- wns_marquee.left=marqueewidth+8
; _- o7 m3 P5 c  \2 X% L}8 p9 u8 m: i& e
}$ w" }+ h3 k% O4 G& t* \% m# ]% }
4 z/ n. X5 S) \$ A# X
if (iedom||document.layers){9 I" K  a- Z/ ~" o
with (document){' w1 W! a3 R( P6 W" O) @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, J) _" r& ~) k) w0 c# fif (iedom){
& K# S- N8 h+ Z6 k+ K% h+ S" |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! n# H. L" M' G% L% e# _$ ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( ], @/ F; |1 {: Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 w' }3 L; A; x0 B9 G1 t. G2 P* ?write('</div>'): n1 B1 b" ~$ q& s0 X6 m& v% H' l
}" J% w" j+ a2 y( _3 D. g
else if (document.layers){
- `6 A& q9 s+ d5 e# U- [* L, Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% h) {# v# o) n; E7 q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' W" F9 F0 ~& q1 Wwrite('</ilayer>')% i) q5 F" G8 g5 v& ~
}7 Q4 ^8 y' L. {5 I; o% M
document.write('</td></table>')2 u8 P$ G9 ~, i7 X# b) p' @; R% \! H
}7 b  h$ r$ H; g2 ~: b
}5 d4 Z; w- g( p' f6 L4 k1 l" O
</script>

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