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

|
网页之跑马灯文字特效
//修改宽度6 B% V; _/ I% M' X
var marqueewidth=300
! c& B3 {, x5 ~7 n8 U//高度- |+ G6 w) ^) v7 r( h' j
var marqueeheight=25
# A6 C2 n& H6 ^. y/ v" p& C- a( r//速度(1-10)
" e! a8 ~* S4 p+ Y4 M6 G4 Rvar marqueespeed=34 S( A* s, q" C4 x1 G$ W
//背景颜色& C1 S0 `4 T$ t
var marqueebgcolor="#FFFFFF". K: A; i- a3 B
//是否能暂停 (0=no. 1=yes)?
9 P/ m# i% }" W$ Nvar pauseit=1
t( ?# b$ o! Y! @: ]) i! |# G, f: x. H: S% z4 q" `
//修改显示内容
$ a# H, |4 y% W" ?( Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 m: w0 ?1 a% p" q8 O9 k$ M, m; l
; w7 X0 P5 t7 F( H$ N0 R////下面不需改变////////////
( O7 L3 D7 J$ H1 G7 b! b5 ^2 V, D4 Y
var copyspeed=marqueespeed
% M* J) b; \# P6 k1 Cvar pausespeed=(pauseit==0)? copyspeed: 0
2 r L. z& t& w5 k# q6 ]! g v3 _7 m7 Svar iedom=document.all||document.getElementById2 W+ A) g: K) [3 ]* Q! d
if (iedom)5 U* x0 Q5 K5 X5 m; ^ n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 d1 ~9 N( n: fvar actualwidth=''
[/ c9 l' N j5 R7 f& Cvar cross_marquee, ns_marquee7 a+ \/ B+ Z, Y
9 `# x9 p! a4 Q4 z' lfunction populate(){
+ d$ \9 r: i6 c+ wif (iedom){5 {3 b# A* g: g7 e8 z |: v/ i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 B7 |' A- c- R# k4 P0 K+ gcross_marquee.style.left=marqueewidth+81 X! F* a- n/ C: f( m
cross_marquee.innerHTML=marqueecontent5 I0 c1 J5 u6 z6 o- }! T/ S
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& T: `/ x( Y s9 Y$ H0 l( N}0 q8 F: A3 G: X! V4 [1 Y
else if (document.layers){
/ _; d! F# K3 @1 D1 B8 qns_marquee=document.ns_marquee.document.ns_marquee2, h& F! Q; B! N6 u# F
ns_marquee.left=marqueewidth+8
+ r# S/ x! r& i8 T: I7 Rns_marquee.document.write(marqueecontent)
& w! ` w4 o5 i5 n$ Ins_marquee.document.close()% t' j- i0 K7 T0 e/ d& K
actualwidth=ns_marquee.document.width
. N4 E0 }! i2 F* Y: S( }7 T}# @7 h6 {( R* P" x2 P. E
lefttime=setInterval("scrollmarquee()",20)
& h: L. y. }& [. ~5 L0 z* S; {}, o, r) }7 ^8 |" t
window.onload=populate
1 l- j, b) W9 D# v* |9 D
& X4 Y5 X0 E, U( l/ H/ D; Ifunction scrollmarquee(){, x$ |; j( Y# n9 C# y4 @) K& N
if (iedom){* M- Y+ x9 X3 z, [9 Q% O6 O9 b
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 l D" h q9 R$ X5 `7 K3 E- pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. h# u2 n! C* ]3 l( I/ T; Aelse
. |4 |+ V4 ^" F4 p% L; k: q5 |2 [3 m& wcross_marquee.style.left=marqueewidth+8
- p- c+ P: Y2 p) l' ^* r% j+ v$ x# @1 g* E) Z
} S! [1 M( v- C) T, X% W6 N' ]
else if (document.layers){' E6 y# d! B1 Z. ?2 W; q
if (ns_marquee.left>(actualwidth*(-1)+8))7 `0 W1 m/ r" m, ]8 R5 O
ns_marquee.left-=copyspeed; _- {% U: s4 n9 M2 N
else
7 w/ M7 D7 t' `9 Tns_marquee.left=marqueewidth+82 p3 k2 [' m: l4 w
}8 s( r8 A8 ?8 [8 I3 F
}
/ L8 |3 ?' k( y4 h/ [4 m, u7 ~6 } e
if (iedom||document.layers){0 v/ r4 ~6 Y& M5 @5 q
with (document){; T1 T' @0 @0 a7 b ]# w5 }$ v8 p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ d$ o! Q) G8 E% B4 j! {, Gif (iedom){
- R; j: ]! o& ?4 f. [9 A" e9 Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 ^1 V' _# E* j p9 M) twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* a2 c* s9 g' x6 d6 W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 @/ D3 m( j& f. i0 t. |write('</div>')( B. o5 [% b1 P0 X# T7 B
}
/ H" w2 X' w7 c% _" gelse if (document.layers){% K4 w- ]1 n) a* X) P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, J0 w$ K; Q$ A) L$ s% hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; ?& V9 Z6 ?9 R. E; Kwrite('</ilayer>')
3 ]- l1 E3 Y1 H. W. ?} O& m$ b& _2 N9 I8 Y" c
document.write('</td></table>')0 Z8 A. ` X( ^ n3 Z8 g
}
3 ~: `) y% S! A5 Q}
1 }8 `2 P3 g7 v! L* o</script> |
|