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

|
网页之跑马灯文字特效
//修改宽度' S6 s+ k' b @. z
var marqueewidth=300
$ P- Q9 v+ i" e) ^. @) J//高度
3 P& m. Z; {* Yvar marqueeheight=25
# Q2 Z- l3 R+ I; g; W6 s//速度(1-10)" F: C& b, }3 e* s4 c7 g' I
var marqueespeed=39 m' a/ J( a8 W% b
//背景颜色4 ?; ]3 E$ i4 j" I/ ?9 F
var marqueebgcolor="#FFFFFF") h F/ h+ K" c0 E& J
//是否能暂停 (0=no. 1=yes)?
$ [2 h8 q& p) i( kvar pauseit=1
1 p' t. A7 ^. m8 K8 ~
3 }4 o0 N0 s+ u- m& ^5 v//修改显示内容
7 w0 f4 S2 M# Z/ l4 Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* R7 b0 C% e+ E) `7 w2 `0 R* p
" X# @7 \; b0 Z9 j+ S2 S# t
( A# \( S/ P! a////下面不需改变///////////// D9 F: `3 n' P6 |- W5 D7 @
! U# x) B8 s- E0 {% R" H
var copyspeed=marqueespeed+ S& ^6 O" {4 I$ l, p
var pausespeed=(pauseit==0)? copyspeed: 0
: X$ } f* m. X: ^4 T- Xvar iedom=document.all||document.getElementById! J6 b/ S6 Z3 v
if (iedom)
% W" w O7 p1 Y6 K& x4 ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ X6 E- I+ w5 z A3 ovar actualwidth=''7 ~- s: v% ^9 l$ X" d
var cross_marquee, ns_marquee7 M% d Y! a+ K
) E/ s4 x7 e3 [, n! Qfunction populate(){
7 a$ B- v; c4 j% j- \if (iedom){
, o/ }& {) V, qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 ]6 B1 `; }. r+ z7 H6 ycross_marquee.style.left=marqueewidth+8
! l' d1 A( b! i- `) i& l% t) Scross_marquee.innerHTML=marqueecontent& J5 L: Q0 G: z% }$ A6 y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# o; {& O3 @8 Y9 X" U V0 C* a( b}1 W+ v8 }9 g: ^- }2 N# s: |# b# W
else if (document.layers){2 \( z- E& w2 l8 S7 h& C$ g+ x
ns_marquee=document.ns_marquee.document.ns_marquee2
& D& y, m* x2 b- ` W+ t- qns_marquee.left=marqueewidth+8& n: S- d+ a& g4 p
ns_marquee.document.write(marqueecontent)
: x/ {2 G t% C# J, B& T5 }* s& ^ns_marquee.document.close()
& Y. i+ Z- r! }0 P* g% factualwidth=ns_marquee.document.width4 P* ]2 O7 m* f2 J0 j( }# j, D2 t
}
4 c6 X7 b p$ c, mlefttime=setInterval("scrollmarquee()",20)
6 I. `; u. J- T |( y0 W}
) c5 I2 a: @1 b w* A0 ?9 l! Kwindow.onload=populate
# r8 S# D) F! |$ f' b. s
) v9 Q" I+ y5 t, s! `% Efunction scrollmarquee(){
1 y9 m1 l) p/ X( E) s; G1 Cif (iedom){
: J& \; Q; \% }6 _( v1 Z+ O* t6 e$ Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. r" K% G9 ^# G8 }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& i* H* b, I4 H' b* @! i h7 helse
5 }# J, t; }3 M: ~4 }; Xcross_marquee.style.left=marqueewidth+8$ X) y* ], V5 J) z4 T
6 v8 b+ h7 I. W; }! {( y4 A
}
. E* c0 l( D+ M9 Y( o9 Welse if (document.layers){
9 L, @( y& z9 W1 P( ~. x; o/ f9 qif (ns_marquee.left>(actualwidth*(-1)+8))
' b- I& h$ f; Vns_marquee.left-=copyspeed
: O8 W( h7 X5 @1 ~9 c# gelse2 B- P, X5 |) H) D+ X
ns_marquee.left=marqueewidth+8
, P% ]4 W* b0 W+ z0 o ]}1 E) \* g1 x$ X3 Z
}
: _8 v# e$ B2 b' C0 V1 M, n& I: E% H# f
if (iedom||document.layers){
$ }% o2 A1 J8 D7 {with (document){
$ J/ ]6 I, ]( i0 e( ~$ p% }- k$ adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% m& L- W2 ]& A! m7 m: b) Y- s
if (iedom){
9 e3 k: _3 g" P. T4 h6 H3 ]! t/ Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 v: V+ P R) v, E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) `0 U& r" G! D1 Y! v2 j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 D8 j3 O5 _- k* \write('</div>')
' b6 A, Q; f9 }/ ~}
7 N! E; ~" ~2 Telse if (document.layers){
3 G& M0 a8 c$ Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" Z* V9 W5 o8 r e8 g1 o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 G: C+ P/ Q2 V3 @
write('</ilayer>')/ h) }# k; o- c; c
}
' r+ Z( N/ r; }8 E3 X$ [3 Mdocument.write('</td></table>')
: z2 ]- j% x* X# q W3 a/ `}
. T* d/ {: J4 c" U& Y}
4 L6 ^6 b! b5 I* T! `</script> |
|