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

|
网页之跑马灯文字特效
//修改宽度
; p+ S( P: w1 S% U! kvar marqueewidth=300/ C% i8 I* g8 Q# G2 v: c
//高度0 R/ K# B$ \5 v& H
var marqueeheight=25
G6 J: F5 Q, H# O) T+ C//速度(1-10)1 p' {# [! F4 w" |- ?! u5 m
var marqueespeed=3
2 i8 S) z5 B- K: g//背景颜色7 s+ W1 I4 ]6 g+ t4 H- a
var marqueebgcolor="#FFFFFF"
. E3 R( P( R# A+ i; r//是否能暂停 (0=no. 1=yes)?
! i8 z& ^) {4 u* p5 Svar pauseit=1$ G" j+ q0 L* h/ Y) v$ m
8 _7 A# v1 G5 `) S& @& r
//修改显示内容
- g" A( V- V! r0 D* T6 Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% N- b: e6 O/ R* e/ h/ y' b# Y% r0 N. E1 X9 q4 P7 `2 p
# `# E$ V! U; v5 V* E4 G1 C
////下面不需改变///////////// S5 Y# { `/ c2 w% N
0 q5 \* k& @8 ]var copyspeed=marqueespeed s1 m7 R. e+ {; e0 }9 T! w0 Z
var pausespeed=(pauseit==0)? copyspeed: 0
! I6 k% o3 o) e6 ^! r4 b: q4 Gvar iedom=document.all||document.getElementById6 n1 f, d" G4 e# n/ w5 c+ q
if (iedom)6 a$ `% x" T x, s8 f& Z' z! P. s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 y4 V. P# ^7 x$ w( Y# P- n% K
var actualwidth=''
: F7 f# p6 ^0 K: G5 N) ^1 Wvar cross_marquee, ns_marquee
- y: N) M3 p, `$ g: d2 ?; o2 G/ T$ a, s
function populate(){0 `4 e3 W, X$ E5 @
if (iedom){* ^; _3 ^) {) i% C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 J: o- N4 f3 c) i% s% e5 `
cross_marquee.style.left=marqueewidth+8
5 g, b6 g& b( U! m9 Ncross_marquee.innerHTML=marqueecontent
' v" _+ w; k0 M! Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* Q" p3 I# }! B/ g
}
& N. G6 E( f) u4 k6 v' V3 ]else if (document.layers){
1 X3 Y2 A% |' R; e: G* E! jns_marquee=document.ns_marquee.document.ns_marquee24 `1 K: O; z1 f+ P f- ]2 W3 f* [, F
ns_marquee.left=marqueewidth+8
' |2 Z* Y6 t( _# Sns_marquee.document.write(marqueecontent)- C- @5 H; g( y* y" _. r1 e# T/ ?
ns_marquee.document.close()$ |* L1 z4 J8 _ F& L1 X3 Y
actualwidth=ns_marquee.document.width
3 I5 D/ Q+ t" }" g0 r5 ?2 X}
) j: n" c% `" h5 r3 Alefttime=setInterval("scrollmarquee()",20)0 o0 r6 n5 ]/ e z& z
}
! h$ x+ O4 ^2 W+ X& L/ Mwindow.onload=populate! R$ V3 u' v4 K
& T( G: I1 a; e3 @% Kfunction scrollmarquee(){
7 v, |( u2 ^$ e5 t6 l: p; z4 ]if (iedom){* c1 O& j, R4 E, d( t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& l7 e6 \2 s6 k& H0 h7 U6 ]% wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* ]* M* R% M ~& R7 i
else) X/ s! D3 X) w! k; ]/ G; f
cross_marquee.style.left=marqueewidth+8
! j! r8 m- e7 Q& {" n
( q# E; y$ j5 l# h8 S1 q) {} j2 }5 J0 ?- R4 ^7 @- M% y
else if (document.layers){
+ O/ J4 @& a; I4 {& w5 bif (ns_marquee.left>(actualwidth*(-1)+8))
( M. B4 s8 |1 V {ns_marquee.left-=copyspeed% A# o( p6 x% w0 Y
else
9 y8 b$ }8 U% ]3 p7 ^) _5 Y! |( G) b" Tns_marquee.left=marqueewidth+8
( q, K/ E2 ]7 r- P, s6 @}
! T8 r8 [: l& l, R% y3 @7 l}
" n/ `, I4 i/ E0 |% s$ Z5 i% F: J7 k: n w9 w1 ~4 W' r
if (iedom||document.layers){
* l( K$ x% n* c% X& Lwith (document){
3 |# ^% T) Q' s( E/ Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( Z/ S- s! ^- e. E
if (iedom){
1 |5 k" O/ v0 W4 W" e9 hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
s( l1 P' _3 _# I+ g0 K4 a. ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 P' d5 ]% i6 ~& Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) M3 U. \: }6 u2 T$ fwrite('</div>')9 A( z1 _! |3 i+ w) O) B& l# A
}- c& T6 K- O: I/ y/ ~
else if (document.layers){5 D! b* e% ?* p K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! Y" \2 d/ e0 f9 \; Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: P6 W* x- ^0 j. X( u6 P$ Qwrite('</ilayer>')
% {0 b: g ]! f G3 H, I# j8 F6 j}+ k, v9 j, s9 M
document.write('</td></table>'), p* x- B2 Z( c( ^2 U; ]
}
/ t: J" ?$ k4 `5 q; x6 Y* ^}% ]9 y. F( o- x- Q# F5 K
</script> |
|