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

|
网页之跑马灯文字特效
//修改宽度
/ E$ ~ E% j$ k& j* tvar marqueewidth=3008 u# }! V( x0 R+ p$ v! [
//高度% a5 i. _$ a* Q0 C- `
var marqueeheight=25" Z$ G- U0 Y( E
//速度(1-10)
: b2 O% F2 N0 e, w* [+ g& nvar marqueespeed=34 i: L, G$ m d6 o
//背景颜色
0 ]" `* T6 M& i; \5 |4 Tvar marqueebgcolor="#FFFFFF"8 H8 O4 x L/ \1 R
//是否能暂停 (0=no. 1=yes)?6 `. U s# ]3 \, C, [+ D- N! u9 v
var pauseit=1
% |, O5 l& g6 U4 k
$ Z( Y$ O. \" F//修改显示内容
4 `2 |: `: H& l( Y9 Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 M+ t3 f6 b F) K
5 ~- }0 w1 A/ f- u1 y. b5 u9 `
# o* h& X" i! _% K( o3 ]////下面不需改变////////////
: C0 t: h- N% S3 x$ T% O
r- {' \+ q; M( X: Yvar copyspeed=marqueespeed( O( ]0 `1 m% s3 O0 s
var pausespeed=(pauseit==0)? copyspeed: 08 x* H$ A- P( l6 x
var iedom=document.all||document.getElementById) ?' g+ A. [1 I7 D" h# v' P
if (iedom)2 s( k/ p; I ?& z- L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* x: x( D* y8 g `% S# lvar actualwidth=''* k4 f$ |1 S! s; e; e( G
var cross_marquee, ns_marquee- p5 w0 s+ ?; _: o0 e, |
( E& {" l4 u, s5 v5 j* hfunction populate(){5 [3 W) v# y0 E4 t6 {0 E
if (iedom){' s$ C6 {: D% h% \, m7 _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 @- L. a) g8 g2 |+ c: e9 |cross_marquee.style.left=marqueewidth+8: x: W- O) g+ J" }" z1 c
cross_marquee.innerHTML=marqueecontent0 n/ i- v4 T' W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 A1 R* T$ J- @. w* U}: Y* ?$ h" }% e: e* P
else if (document.layers){
! W$ d& J+ e- X3 t# |* xns_marquee=document.ns_marquee.document.ns_marquee2
! `3 ^8 ^8 u7 l. e( O. Dns_marquee.left=marqueewidth+8
, V& w* g7 n9 v" j0 F4 Ins_marquee.document.write(marqueecontent)
0 q# o' w7 v r* G- D/ Vns_marquee.document.close()7 K5 K( t M% n' E$ J( J- S. V
actualwidth=ns_marquee.document.width
" v3 ~$ `4 U: Y! J}7 H1 o; ~8 _: b5 S) k ~3 a. e
lefttime=setInterval("scrollmarquee()",20)
0 ~# e9 ~4 a5 q& X& [( Z, R$ ?}" [7 }5 H2 }9 ~7 ^
window.onload=populate
( Z. S% q* `, I5 L7 m& x- I9 ^2 I2 p- Y8 y" q
function scrollmarquee(){
" j% D5 `- U6 C" Xif (iedom){) O7 T+ @7 q9 L; O% t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! E; `0 t2 M6 C$ Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 B# H! s: G# o; Qelse& r) }" ]4 z7 y
cross_marquee.style.left=marqueewidth+8
# G. _6 D/ s) Y4 J5 g' @8 A% D$ B0 F, Z+ x1 D/ E
}9 y0 t; j( N# R- z1 J" t( H' i; I
else if (document.layers){
, {% l1 B) ^% q0 x6 v" Tif (ns_marquee.left>(actualwidth*(-1)+8))3 D# Q: D/ x' V! T
ns_marquee.left-=copyspeed
+ v0 o9 ?! r; n5 j) a4 w1 Kelse$ `' o! n6 c1 Z
ns_marquee.left=marqueewidth+87 j) y% k( V0 F: Q/ J
}5 y& o7 T9 F3 L
}5 S$ E* Z( d* R6 z9 M) y
! }/ z9 E; a' Q' g7 M4 ^; w0 g
if (iedom||document.layers){
+ Q( x5 z# j6 ^9 ~' {with (document){' U# \: _* n- W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& f3 ]- j0 l, r' V# U% J) aif (iedom){) _; q k. A# z% j. x7 V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') N8 K2 ?9 v, c( b m- f+ k9 h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 D1 i. x$ B7 `6 a8 i U- _7 ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 u5 H; A1 I) ~" Z. n# b v& T. Jwrite('</div>')( ]: S1 f% m* F0 R0 j
}$ _/ r( x3 G) M- p
else if (document.layers){
+ c/ J- E2 L; j0 P3 y+ w* Q; f3 M. ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ B6 }- m" t L9 T! l( `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 r" B' K5 `6 ^write('</ilayer>')
/ I9 }( b1 g; ^}8 [* |( r" e5 }/ R0 {. n; g
document.write('</td></table>')( R- H2 j6 j. ]+ {% j
}& {5 J% G1 ^& W2 P/ e) _
}
( X t7 ~" a0 B. O# _</script> |
|