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

|
网页之跑马灯文字特效
//修改宽度
: X3 q5 a1 E# z# Uvar marqueewidth=300
* J5 p' L2 x7 A: _9 k//高度
1 x5 k# t( H; R, G0 A0 ovar marqueeheight=25
( @9 F& a/ ? C0 ]' d3 Q//速度(1-10)
7 {5 G; D9 z7 t- [& |% i2 @var marqueespeed=3
$ f8 {4 Z' R3 t2 V# j/ P//背景颜色
! B. i4 H: |/ Q3 y7 Kvar marqueebgcolor="#FFFFFF"
. ]! F& A5 R8 w//是否能暂停 (0=no. 1=yes)?
3 a0 b6 G& {+ k+ q& kvar pauseit=17 Y* q2 }/ V! m5 ~3 N
' I$ I. c7 x" d7 r+ `% ]//修改显示内容
) |3 A; u- L1 W7 G H a2 N. Q3 yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 p/ ?, D6 R: F, m5 P* d
2 R% m' w* [; I% h4 h- C0 f, d) n' C* u$ \8 x
////下面不需改变////////////6 b% B% I6 u+ F
! G+ ~' ^# u. F2 s! e3 a7 a
var copyspeed=marqueespeed" x: H6 H6 B. G5 C0 b6 H
var pausespeed=(pauseit==0)? copyspeed: 0
0 w9 F9 Y R" B; u& Y. Nvar iedom=document.all||document.getElementById Y$ W% X$ G8 V7 X0 L8 @
if (iedom)
! p4 v( ]4 K: V8 r" h. Q+ idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: U6 t" I! o6 j5 c0 I/ n) T4 Y' }+ avar actualwidth=''' i! ~: |- {6 W
var cross_marquee, ns_marquee! h# l2 ^* F/ v' l% _9 l
0 b4 B% A8 @* bfunction populate(){% [: p. e, v# P3 W# w# G4 }
if (iedom){ n, i' ]% F8 ^5 u7 M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, S; b2 `% L1 ~ f; j' t4 J& @cross_marquee.style.left=marqueewidth+8
& F5 G7 Q, Q4 [+ F' Zcross_marquee.innerHTML=marqueecontent4 u7 Z4 `4 ^3 b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, G3 l/ M% q/ W8 E2 I( {
}) t; v1 M$ Z5 y7 f1 H
else if (document.layers){ V: U; @; f, }$ R% q
ns_marquee=document.ns_marquee.document.ns_marquee2; d) ~$ v$ Z6 k i3 H7 ^! ?" |
ns_marquee.left=marqueewidth+8- U# F) w e* k: f" D6 x
ns_marquee.document.write(marqueecontent)# \3 Y8 i' N0 K+ s8 R
ns_marquee.document.close(), }: A" q# K( H( O( O: A+ L
actualwidth=ns_marquee.document.width& D) ?0 [- G8 E' M2 S; X
}
5 F) e8 H6 A5 B& d0 k& s# ylefttime=setInterval("scrollmarquee()",20)) A* Z( w1 B+ F# b
}
6 V# O/ X$ ^& {# f' y" Hwindow.onload=populate
7 j% q" I- a* ?! n; B* Q% V2 b3 G" J+ W; ~
function scrollmarquee(){
4 h2 h4 v3 M; r, oif (iedom){: q7 {% \( ]# Z3 {- j* n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: R$ r& b1 O+ @9 ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* J# `/ D* u0 L) B
else8 Q. L( q2 n+ Z
cross_marquee.style.left=marqueewidth+8
' A! `5 i$ M% a) q/ E6 o
1 }* G" U% I: S5 d! _}
/ k8 G$ p- m! z9 selse if (document.layers){ F* z2 I5 D% F' ?+ s6 J
if (ns_marquee.left>(actualwidth*(-1)+8))2 c" J. D v" p. W
ns_marquee.left-=copyspeed) S+ G$ z y4 O& K2 U* K
else
' h+ a4 T5 |; ins_marquee.left=marqueewidth+8. k- q) |2 L; ]7 Z* ?
}4 R, R$ x' U. @9 I0 N
}' ?8 U/ C: v& A+ {& z3 ~+ T
) x0 h4 h- m" r* Y5 J% Z# Oif (iedom||document.layers){
1 U. f' j' H) a+ V+ iwith (document){( Z6 @! n4 @" P* B1 z1 M1 ]# c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, c6 S; L* j4 t. K( b/ Eif (iedom){
9 {% x9 u$ p9 b3 Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 J& i! F6 Z5 i0 s U% R/ ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( R* T* V) H8 \9 T F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 v0 g: A+ b; n/ lwrite('</div>')
4 H% q9 r$ D; J6 L9 p E}* k2 q& Y6 G! E" E S \6 j, ^( T
else if (document.layers){3 |# \, q8 ~# z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& \3 b6 E) s8 r7 V) ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 X$ l( a, M; E& D. c
write('</ilayer>')
7 k8 l; a4 c2 V7 F& k}
7 \3 a% {9 |+ K8 a. I3 @/ fdocument.write('</td></table>')
' A1 U/ J+ K' V& A0 v}0 E& r0 ?6 I1 K
}3 D: ?( B$ M3 r7 E$ {) f
</script> |
|