|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
; s! W+ e4 I2 S) K$ u* v; W, X2 \var marqueewidth=300. e. I# f) s# o& r$ P" f# f& L! h* O
//高度
3 I: z' M4 V1 F kvar marqueeheight=25
; d+ s, Q$ u# r8 ~1 ^//速度(1-10)' E5 P3 Y, b [& D$ X2 s7 v
var marqueespeed=3, x' A& u) ]5 Y8 w9 Y/ z+ ~) j
//背景颜色( T2 r! o2 v! p; A
var marqueebgcolor="#FFFFFF"
- W# V7 Y, n" ?' y( W1 o+ T//是否能暂停 (0=no. 1=yes)?" i, ?5 t# p5 K# Q& N/ G; |
var pauseit=19 q2 u; o; E* d3 I ^" \; [
9 h. z8 {7 T& ?; O& Z
//修改显示内容
8 ~0 {( `. ~8 y( y+ ?4 |2 c" Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 o) T% n1 k7 P2 W* X& v
; x, t% s# H' c6 c: f# d" l0 q$ q! \6 x/ r
////下面不需改变////////////8 ^. ?; p9 s; o7 J. P7 @3 N, P
% h$ J( d6 n9 g t6 ^- `, F
var copyspeed=marqueespeed4 ?9 R1 |6 |7 A4 ~2 J" x4 |
var pausespeed=(pauseit==0)? copyspeed: 0
! a. k8 u- C9 ~3 m. {* xvar iedom=document.all||document.getElementById
4 K' ~! \/ R" Z& j; H7 Fif (iedom)
5 C. C9 V: N8 S: Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& u5 \/ A# G) w! Z& N- x1 W6 F
var actualwidth=''
1 h, z, m" R7 m1 |" N* bvar cross_marquee, ns_marquee* w$ l6 i/ S( g ]9 w6 p2 o
J1 G3 A9 u; E, Wfunction populate(){
+ B9 _% i& [* G6 Pif (iedom){
( S9 i( R% A8 x/ T v& A; X" icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) `: C. r4 u y8 N+ m& j- R2 d1 {
cross_marquee.style.left=marqueewidth+8
, W! e* u* u! e! Ycross_marquee.innerHTML=marqueecontent
( X8 K9 L( ^) ?! x0 f. n0 ^, factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( n0 d+ S% m$ y}
; M! G/ q1 j! p) Z' ielse if (document.layers){6 m5 N6 Y) o) N) L$ F7 w* D4 M$ `
ns_marquee=document.ns_marquee.document.ns_marquee21 M: E) j9 f7 y. f* H# p
ns_marquee.left=marqueewidth+8# H2 j4 G" w% o) ^2 h- S
ns_marquee.document.write(marqueecontent)
/ t" b/ c- l* B9 H7 L& tns_marquee.document.close(), {% E' h' I5 l+ A s7 M
actualwidth=ns_marquee.document.width
( Y4 I: G: V' A" m) [}
, \% F0 V3 i3 H; o$ f: `9 Glefttime=setInterval("scrollmarquee()",20). n5 A; I! f9 B) ~: R
} i8 O$ S+ a z- G$ W
window.onload=populate
' G- n1 @) T) l: H
3 P3 v4 t. U. p' O- `" Yfunction scrollmarquee(){
' L2 s3 |/ D J# vif (iedom){
, p. g; o, \/ m* @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 }$ z' Z% f" X0 M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ R% v/ H/ ^% R% ]: G& Ielse# u7 f5 d( k- j- J5 ?8 x% f/ k
cross_marquee.style.left=marqueewidth+83 g* ~9 h/ k! L, a
9 v. B. N2 J5 |3 ^! ^}* @7 e' U @! H( |: [& H; g
else if (document.layers){$ ~% N4 K9 g9 m
if (ns_marquee.left>(actualwidth*(-1)+8))6 \. X% L& W3 N0 F! ^
ns_marquee.left-=copyspeed
" x: M! S' r# N( v V8 l9 }else
% i, ]7 [( G5 C# W2 H/ Cns_marquee.left=marqueewidth+8
% y* K$ ~ [/ s7 H}7 o: |. y9 O: c
}
: H; ]3 D2 {2 e, J
+ p+ \: G1 ?/ o/ D o; n1 w$ P0 Zif (iedom||document.layers){7 y4 v: I5 |9 [7 O1 ~% F! U, u
with (document){
- u B4 ^) j' J4 R) u+ idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ o. u1 d3 }+ c( P1 J3 ^ `if (iedom){
- ^& L/ V& j& X5 A! t& A2 |- @$ c0 rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 r( z4 I! O" T" v# Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: U% t# X& ~( N; d' `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( l6 U3 T% m) |2 {$ r/ X1 }write('</div>')
: i. r, B. k) \1 f4 ^* k% w/ l} g- \; a' G9 x
else if (document.layers){$ q& u9 \; U9 d% @6 u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- Q4 i2 W0 E5 H- \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ i8 L) L. G# w0 ]" ~, I$ r6 cwrite('</ilayer>')
9 [) r* @% c9 g4 _! V1 u}
& [+ O* [* M$ C( L% E" l$ s$ `document.write('</td></table>')
/ t9 a# x* Z0 ], Q2 t}% U5 `- m+ g; o" L2 |
}* Z! C( l) `1 \. U' h% F
</script> |
|