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

|
网页之跑马灯文字特效
//修改宽度: [; o) H u' @1 y& Z
var marqueewidth=300& R6 Y5 r/ H3 | r+ g
//高度9 t" E4 @# l; n0 Z
var marqueeheight=25
0 N; J# p; e9 M) d) L* z/ K//速度(1-10)
( n4 t& u) j' pvar marqueespeed=3
# x% V0 E6 @2 Q//背景颜色8 U& Q& G) f: h& l
var marqueebgcolor="#FFFFFF"
$ A: c0 o' r% ? N8 A//是否能暂停 (0=no. 1=yes)?
4 P8 I7 s0 \0 B c+ ~var pauseit=1
" ?2 n. b: p3 R2 ^
0 G5 {6 m6 b. E/ ?//修改显示内容/ z9 m& {5 T: S$ }) z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 u- p0 f3 P) D4 @9 T! i: L. W# F }3 ^) ~5 ?4 e& b
. Z* n/ Q& O; h9 n////下面不需改变////////////
4 K( K4 b9 H" I2 y
( D" X! F, _% n/ Gvar copyspeed=marqueespeed
N ]3 B) |: i1 D, |" f/ w! Jvar pausespeed=(pauseit==0)? copyspeed: 0
( Z; z# a! l1 l6 }; v' V* c% Evar iedom=document.all||document.getElementById
( g: D; c+ T4 K# L5 G+ |' sif (iedom), P: R2 J1 ~/ N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 \, ~ ?+ D( Y R
var actualwidth=''- `/ E& K/ p) r7 A5 V
var cross_marquee, ns_marquee" b# @/ w! R, i( y: h9 s# }
- O2 J3 o: Y, |8 J) d
function populate(){: v2 @6 p# [ i1 u' f; X
if (iedom){
0 O& `% J' K6 |1 n' _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 R2 G. N# @. q
cross_marquee.style.left=marqueewidth+8
( j' A; A5 Q$ }) {cross_marquee.innerHTML=marqueecontent
# i6 e. B, S4 R+ E6 `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% m ?4 j& v+ O3 Q8 E+ [
}1 D) U# g' t* h5 o0 p* h* w; _
else if (document.layers){4 ]* w& s t: U6 g+ P
ns_marquee=document.ns_marquee.document.ns_marquee2 @7 U1 B0 k) v3 d% P$ v4 S
ns_marquee.left=marqueewidth+8
) p* e: b3 ]* I! p6 zns_marquee.document.write(marqueecontent). p' @9 V; q' J
ns_marquee.document.close()
6 a: z0 B5 V# G2 o K6 M) Uactualwidth=ns_marquee.document.width
/ M# v# a" Y) Q0 a}% ]/ o- p" T) U( w/ R
lefttime=setInterval("scrollmarquee()",20)
" P$ L: L4 S: H! w3 S( E* d& g}* B7 Y9 j5 S! t4 U$ w7 v d0 s5 K* c
window.onload=populate
( v( L% v' o' c& {" o0 o: l! g2 @9 l! t Y3 G2 _
function scrollmarquee(){" }0 r! |5 J0 C
if (iedom){
% q+ {- g" Y1 e5 u( j8 Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& Z8 o* n5 p. y0 w" x# m, y! B) E: {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed ]; f8 I8 ?+ \
else, W' H- O* @8 M; B J& ]
cross_marquee.style.left=marqueewidth+8! t" I& b$ O6 F! s/ q
% I: Y1 _ q' S
}
7 f7 G/ P+ u2 l3 l2 ~7 Relse if (document.layers){
) `/ _" t# F2 A8 F8 c! Q) V Z: Bif (ns_marquee.left>(actualwidth*(-1)+8))! |/ r6 A) h+ w8 B3 G
ns_marquee.left-=copyspeed
! s# v( k8 |: `9 }4 t+ Lelse
6 L" o1 P& R8 U5 rns_marquee.left=marqueewidth+8
! {4 q( x; q! I; @) Q7 n$ l}' }3 q) j2 C, E5 ?# O; B
}$ H( j) w a6 h8 G* U
/ h* l3 T& K; \0 s+ D; K1 ?
if (iedom||document.layers){
) }6 P( _1 m, n( V# F8 {$ ^9 }with (document){
6 ]* Q+ X1 B8 J/ [/ m6 `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- ]( k5 f" `0 p5 m9 Zif (iedom){; w% T- m# u2 @7 O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 h* i" ]) n. z2 R& ]( ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* v5 M( C! K. D" Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 o3 H( K/ d6 ]8 i8 L9 Ewrite('</div>')
/ u2 b M* ^4 S3 ^) A- C! z2 |}
# F/ r2 {* V) J; s1 J. Delse if (document.layers){' E, H! e& A3 {- [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ G. R$ R7 g7 I3 @/ ]8 O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) f" ^$ f, F( _, Z* pwrite('</ilayer>')
: ^& R. S) K& |) Y5 _}
X- k; x! y9 P' ndocument.write('</td></table>')
4 @+ t' L8 r! ~/ p2 U! M" w3 K: w}
" B% M! U- b2 l0 T! ?4 m}; S h2 k. K- J8 C% Z
</script> |
|