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

|
网页之跑马灯文字特效
//修改宽度5 l# b/ M/ F0 B/ e% }3 ^6 m
var marqueewidth=300
6 l6 D% p( m; u$ d//高度; ?; } Y, Q3 ]) W) X* y- G
var marqueeheight=25
& |2 g2 t3 Z" k6 f//速度(1-10)
. C0 \9 e6 @! l( ^: |var marqueespeed=3; g C" H8 K. T! Q* a" u
//背景颜色
, |* @% B @& Y! E( x hvar marqueebgcolor="#FFFFFF"
8 x) K$ b9 T* d$ [//是否能暂停 (0=no. 1=yes)?
/ { b; v+ T' O( m% z5 v9 j4 x8 Mvar pauseit=1
- p; u9 D$ a; D T+ q% I& t, _/ X; R
//修改显示内容 k3 t% i4 F: w* n) f# W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 G0 z: W8 v4 T
7 u. B' r" S; X. t
6 ?* I! P; w) J2 K////下面不需改变///////////// X4 t2 r# Y$ L
0 {; |% R B* E5 @1 Z; }7 avar copyspeed=marqueespeed
4 `: r9 ]+ R$ |# J+ _var pausespeed=(pauseit==0)? copyspeed: 0
2 |: ~4 {3 {: p9 [var iedom=document.all||document.getElementById& ]% J1 m* g* q
if (iedom)5 r- t4 y; m1 U( z) }2 d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. m! H; P; Z, H% avar actualwidth=''+ P; v7 J9 v1 g1 Y
var cross_marquee, ns_marquee
& r. S# {! S }) E: \, s ]6 Q+ O" K/ N
function populate(){; u! Q$ \+ D0 r' \* Y5 g
if (iedom){
0 ^$ |! b. Y5 g& @ c5 T, Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- @+ x; B# g4 M3 K( n4 p5 B/ t
cross_marquee.style.left=marqueewidth+84 o- }1 {" d% X p# t3 X
cross_marquee.innerHTML=marqueecontent
; T% J A" f; Y; X# M! ~; Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) E3 F- q( n, e; P}
) F! q( @5 z9 c+ K2 oelse if (document.layers){
t2 U- M( K. e+ _; x% Vns_marquee=document.ns_marquee.document.ns_marquee2
8 l0 N4 K) L/ Z7 v. H/ Bns_marquee.left=marqueewidth+8* Z( N, q0 b3 }8 @! `
ns_marquee.document.write(marqueecontent)
2 T9 |3 t; z5 T' R1 N9 n( rns_marquee.document.close() \% V. I4 ]! U. F2 q, b/ E( g4 D( o
actualwidth=ns_marquee.document.width' [% f3 h3 K+ P# U$ H- Q0 ~5 d
}
! Y0 l( T' ^) k3 ]+ `$ q1 nlefttime=setInterval("scrollmarquee()",20)
) C$ k3 a* A; P6 I6 I8 k! n}
9 V: s7 N+ C# `: D4 Z' twindow.onload=populate* @0 f) H6 K& L! P1 g- ~7 M
. \" q1 @3 X$ n7 B7 T0 W7 u$ L9 dfunction scrollmarquee(){
2 R+ c2 v; H; a7 a: Oif (iedom){( @2 j, x; {. z- Q: h/ q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' F. ~5 P; Z# T. S- {! Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' R3 A1 Y- a2 l% z1 D6 h
else8 g. D3 u' U9 `% T' @' p; f# s. B
cross_marquee.style.left=marqueewidth+89 f7 j6 ?0 m8 P/ ?# M
4 ?0 r% l- E8 z' x( g
}
0 ]! ^- F4 d" n5 Y1 F7 c$ felse if (document.layers){
7 c% Z" _2 v1 S9 a4 h) t3 J1 Yif (ns_marquee.left>(actualwidth*(-1)+8))
+ \, B2 h/ ^% |! g/ B& r+ Zns_marquee.left-=copyspeed2 {# m1 v ]! j
else' o9 x( `9 p$ S; a
ns_marquee.left=marqueewidth+81 z$ f& O1 r7 I7 _3 d
}
; u" p8 ^# e: t6 ]9 M* {}& ]' e; u4 y0 q. O- ^
4 D$ b. C ^1 {6 f3 J nif (iedom||document.layers){- w8 I- ^5 G8 v& p+ Z
with (document){& w4 ~* y# f+ u7 ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 J4 ~1 a3 @% X( {' c$ D2 Aif (iedom){+ M! m: V+ H9 V- U8 V. J+ f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ j% g! C2 I) q$ k1 ]/ B4 V& l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), |" P+ w3 z5 n/ E% y- z; E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): W0 w3 ~ l( D
write('</div>')8 k" l9 e2 U) l8 Z |7 `
}5 D4 s. Z/ L* l4 |2 L" k) E8 J
else if (document.layers){& q; U& P0 Q9 k3 d3 S) I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% J0 w' {0 S2 S2 g; ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' e- ~$ O0 z0 e# |write('</ilayer>')+ s5 S. l; z/ ?6 q5 f9 r; L
}
+ L3 K" u( n2 J; U) k% R9 k1 \document.write('</td></table>')3 v& C, C% P" j# _( k0 a
}
7 n% X5 R2 w! t J( C; U% A2 S3 B$ a}" r6 o" ?1 p( ], [9 ?2 T
</script> |
|