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

|
网页之跑马灯文字特效
//修改宽度0 A; v# K- a z2 u) G
var marqueewidth=300
/ {0 K. m" ]) E+ N//高度
* i' @) D* I1 h9 c" M( dvar marqueeheight=25: ?# I0 ?# q0 m% O) z
//速度(1-10)
u* m( D7 @3 ovar marqueespeed=39 C' h9 X9 x' ~) o
//背景颜色- e" [3 a* O, U* ]1 k' G
var marqueebgcolor="#FFFFFF"8 Z, v. m8 Z4 U8 u. b" i
//是否能暂停 (0=no. 1=yes)?$ I1 J' a0 ~# F
var pauseit=11 @, v6 |4 |+ c& J. }2 e
; _# C* l& b8 H6 C# [//修改显示内容
. e4 C, f9 X3 B Z. ? [% U9 Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 Q. K/ b* {2 B& V3 y1 ?! e/ `
) f- s: Z! N" N- k, h
6 K5 M; C$ `- I8 u////下面不需改变////////////
( ~) [; Z5 V* M' I
, C" u9 A, y! v) a3 V: @var copyspeed=marqueespeed7 I5 t( ]- l$ h0 ^ d4 i
var pausespeed=(pauseit==0)? copyspeed: 0
. Z! s9 a1 G) S* E: C! Evar iedom=document.all||document.getElementById
, K g5 l: \9 E( y% ^if (iedom)
$ @+ b7 Q- @( @( t( G% P8 [/ [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) j0 p& G9 y8 l" U9 yvar actualwidth=''* q) B7 F6 D7 i, }5 \/ v
var cross_marquee, ns_marquee
9 s, X6 B) f+ a$ J e& x" i5 V6 H& ^* K" B4 r& F: ?
function populate(){; Q( n0 w. |; |
if (iedom){6 c- u8 H* _( U0 g! o. S9 `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 B l% I& Q7 e, M4 O
cross_marquee.style.left=marqueewidth+8
2 q l) q' M) L5 D2 f5 v' Xcross_marquee.innerHTML=marqueecontent
8 i( X8 J2 ]' k3 m s* Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 ~3 N- s) p& ~$ m: C4 F
}
7 @; T# Y. Z* n0 h% {2 belse if (document.layers){" g4 T, t# F/ G* N1 a: Y3 x/ ^
ns_marquee=document.ns_marquee.document.ns_marquee2
% H$ w! `! u) b4 p6 o; L! q* x( Vns_marquee.left=marqueewidth+8+ Q# y5 i* B* A8 V3 H% r
ns_marquee.document.write(marqueecontent)
$ A, \) h( m; p( f* W. {ns_marquee.document.close(): `' V" F( S9 n( _2 Y3 {: T I
actualwidth=ns_marquee.document.width0 _6 [6 n Q2 J9 R
}+ J$ O' R o' n
lefttime=setInterval("scrollmarquee()",20)
3 A) [& R. }8 I0 z3 D}
6 [# F2 c! w# V: p" fwindow.onload=populate$ i0 w) |9 ^; F9 @- N* g& F9 k
: P S+ R& i+ {6 ffunction scrollmarquee(){
4 _; j, y- i# D# C aif (iedom){
( o `9 U# U! t8 G" `+ \# I" Z+ zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 V: J' B, R8 y/ ^% Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 e- O, C4 ?- @2 m( d& E& O7 n$ J
else5 J4 s5 F! R/ G4 B
cross_marquee.style.left=marqueewidth+88 @8 ~6 B! X% a2 I: M4 _
, b4 x3 u1 _! }}) g8 Y% i& @7 p& r' v. n( P
else if (document.layers){
! Y! M, Z9 G5 _' Q9 l9 E- x$ q* i. w& Pif (ns_marquee.left>(actualwidth*(-1)+8))
! ]1 d ~ l, w# zns_marquee.left-=copyspeed c: D2 X! ^4 _9 P. _3 G" ?. G
else
# x. v8 t2 E. @8 a0 qns_marquee.left=marqueewidth+83 Q1 ~& X7 \$ c Z! F0 v
}
0 U# y# C( `) U! N}4 \) v8 Z4 @; {1 b4 {) }5 x+ {
0 ] u; y& ~$ A1 t( ^if (iedom||document.layers){
+ C4 w+ M! z4 qwith (document){
" T" _) v& g) P, c% X: P; ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
X8 l% l) H% Fif (iedom){" t7 W6 l1 ]2 I5 P3 d8 c: E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* ] ~3 E1 C5 ?- w1 e! k- R+ u+ N+ g7 Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') B4 L; p( U* |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 C; o4 V3 V! g# Z/ [write('</div>')
! k2 F7 F7 g. C}* M' T1 O' y, a: X* _
else if (document.layers){7 a1 T( E$ T. \. m/ [, b1 b3 H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, @8 z6 T+ `/ @; z# kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; O$ o/ t* G0 W% bwrite('</ilayer>')
! d& L, U6 s4 p# K}8 q0 o, O0 g/ S9 Q5 \$ ?
document.write('</td></table>')1 p' D Q" ~% |3 F: A4 T0 A
}7 f( K4 q3 ^* P+ f# d
}
& p, p R# [( y7 P+ n Q</script> |
|