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

|
网页之跑马灯文字特效
//修改宽度
3 c! T. i9 d# t* E1 ~4 tvar marqueewidth=300
( _& C5 A" P Z% {: v//高度& B- d" W( m9 J$ n8 E- s# Z: H
var marqueeheight=258 \9 X$ g7 w) x- t
//速度(1-10). P' [1 J5 v `: W5 O5 D' R
var marqueespeed=3
4 n) _/ ~ _* c9 n9 _//背景颜色- Q3 H# h; B0 W4 q: r
var marqueebgcolor="#FFFFFF"
: N! g) W. M( T8 P+ [- P//是否能暂停 (0=no. 1=yes)?
/ A: F& w. Z8 p ]+ P0 Kvar pauseit=1; n$ p# q7 X# H& X
) r4 L" E# g4 h* E. i
//修改显示内容0 q0 D# x6 v; U( t7 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 J. k0 s7 `% }8 C8 e6 W3 a6 C5 G
& ~" @/ F& ]6 ]. s7 t6 N6 C( I4 h# j2 m- h4 a% c2 C; d# q
////下面不需改变////////////) U% b* d) P* n" \; D
7 @- d/ y1 P" K' f+ j m( fvar copyspeed=marqueespeed
) B. [6 G3 h. zvar pausespeed=(pauseit==0)? copyspeed: 0
- D! S( ^" m+ i& Rvar iedom=document.all||document.getElementById
0 `9 q' O4 }- q& p: R6 \if (iedom)
9 Y4 |2 ], B) {: a8 v- _+ Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): U5 v3 `! Z+ h1 ^* t2 Y0 M
var actualwidth=''/ g& F- \" `( s- ^$ P! [ s N
var cross_marquee, ns_marquee
- N6 J4 L, e3 W. x4 I) i& ]% V7 V3 y
function populate(){
3 l6 O: m; a4 u! Q! zif (iedom){
8 I: _( S7 J- {cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 N# ~6 {; g" L" v; U
cross_marquee.style.left=marqueewidth+8
+ w ~; F! w7 e- a$ f' I! y4 Lcross_marquee.innerHTML=marqueecontent& }9 B& f8 Y u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 b( K. T) ~) d" R2 a% z' n
}
% {3 u& A. ?3 P; T& oelse if (document.layers){7 Q5 s% t% W4 v
ns_marquee=document.ns_marquee.document.ns_marquee2) D5 ~! n; b1 g3 [) h' [
ns_marquee.left=marqueewidth+8
: b- K7 Q3 z5 C' e& b% X2 jns_marquee.document.write(marqueecontent)# E' \! q v6 A+ E |0 `4 z
ns_marquee.document.close()
7 j$ h9 t5 w4 c0 }$ }actualwidth=ns_marquee.document.width
' ?0 a: y$ p. g$ o- V/ ~, M- Z}) o* n* g( x- O d5 D! o
lefttime=setInterval("scrollmarquee()",20)
5 w; A" U0 w7 X$ s& R6 R}
. R, _2 F1 ^) T' Swindow.onload=populate. Z( P1 Q/ g- g- o
& A2 E* Y* U7 J! n8 c# ~0 _) Q4 k
function scrollmarquee(){ W; P: b+ g) Y1 u- Q& N' x
if (iedom){
; `: v! [- _7 x$ o7 G) [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! ^7 S- G7 C: t9 X2 j9 V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 z! v! e, z0 E0 B ]9 {7 n" helse
( t7 l" f* j$ q; O8 W& ]cross_marquee.style.left=marqueewidth+82 I* F# {4 e9 B$ K
: M3 l0 D# t4 i$ a+ @( U2 e [
}
7 m2 ~9 X4 b5 f. p; r ielse if (document.layers){
& i) I, h& e2 R# u! s: r: j/ d1 vif (ns_marquee.left>(actualwidth*(-1)+8))7 {# d N9 H' I) e5 O$ A4 r
ns_marquee.left-=copyspeed
3 e5 e* |6 G5 [else
: t1 x" V3 ^) c! wns_marquee.left=marqueewidth+83 l' a6 ?. _# H1 @7 i T
}6 Z. } h: S. g' r) I
}8 n# T- {5 U# x' y1 p$ L
5 i7 r9 U( F6 b! s( W
if (iedom||document.layers){2 G7 s5 d. }2 n# J& w9 _$ ~ n, \
with (document){
. S0 g3 Z- `+ b& b3 H( o7 k: Y; X9 ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 P" _ _4 A' N* s0 Z
if (iedom){* |3 u/ O8 T6 _6 [+ W! z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- _9 ?3 L' T9 s( ?. _& D* n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, B6 p" o/ M* q! m2 Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') F* Z9 C* |$ M4 V, B+ y
write('</div>')7 n3 c4 x1 u) p- @- b) R- Q
}7 X/ X/ B; P7 T2 l0 N3 z
else if (document.layers){" V5 q5 j6 ^7 @' U" l; O- b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( I) ]: g% Z9 U) Q% mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! z% z; ~8 ?% M" K6 C% y
write('</ilayer>')
8 |3 }+ F9 K/ x, Q' D}: Q5 k* s5 N q- _2 O+ j! ~
document.write('</td></table>')1 k+ p! m) m" y
}
) W. s5 ]* U \) ^}! A4 {+ S" K0 V" z& I
</script> |
|