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

|
网页之跑马灯文字特效
//修改宽度 n1 y* a, _ q. N9 H- V) I
var marqueewidth=300- @/ }' ?. T/ J$ C5 x" j
//高度6 M" f, }! G" M
var marqueeheight=25! G" T. h( e4 e4 U0 X
//速度(1-10)
$ G! o% o( s: ]+ h' t! evar marqueespeed=3' b* s* V! @& M; A3 U* @: C8 @ ~% `* S
//背景颜色
% e: f. z, X5 B/ O Q2 ?var marqueebgcolor="#FFFFFF"
( |: ]0 h; _8 ~; ~//是否能暂停 (0=no. 1=yes)?
" h/ F' |0 p$ ~: X" Y. mvar pauseit=1
0 k& B6 f d8 K. z! k# i" X5 m n5 ^0 L0 y- S3 k& m9 @
//修改显示内容
1 l0 k" K: m4 C& P1 G% X+ }var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- T: P% A2 E) W* Q- g+ \2 N* ^: O2 M' e
9 @( M; x6 B+ C; y5 ~2 a- C////下面不需改变////////////) y' [2 W# y Y4 @; I* V
+ ]% J" T3 s, ^4 J1 b
var copyspeed=marqueespeed; G3 x8 n7 {6 A( M$ u% Z' U
var pausespeed=(pauseit==0)? copyspeed: 0
& N5 r: }& W$ N( v8 }var iedom=document.all||document.getElementById" ?( x* |$ D& u3 e, x1 Q
if (iedom)
6 Z1 f: Y q6 R. j j8 |; o* h/ _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' k) _/ g& `7 d( F. B! L
var actualwidth=''* O5 l- `. J8 N$ s Y) M( V7 a
var cross_marquee, ns_marquee/ E" Y! r, q" v% P+ B! J. S$ q+ ~ s
0 l: S0 y9 C& K8 L5 c/ b
function populate(){" t; q7 j7 i. y1 t
if (iedom){- i a5 e; H7 e! S7 A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 T' y) k( P; k1 r" }
cross_marquee.style.left=marqueewidth+8- x9 x1 p: T8 a# @# u
cross_marquee.innerHTML=marqueecontent) n+ n. J! m( M7 ?7 p/ W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& A7 k8 i; W8 z+ `1 Z
} k8 J) U8 O: w4 P/ }- I
else if (document.layers){
8 s. Y4 S/ x6 O7 m% pns_marquee=document.ns_marquee.document.ns_marquee2
& f J6 O- F' r) c# @7 H3 wns_marquee.left=marqueewidth+8
. h' {# T3 R ^( }" H' J, s6 D# zns_marquee.document.write(marqueecontent)
7 C2 U3 P0 D0 h" T8 E6 a" N! Zns_marquee.document.close()
4 m- {9 R2 y) I- lactualwidth=ns_marquee.document.width7 Q% \9 S$ z7 H' K* J8 o" X
} Z9 }4 X, v' W$ z6 b# O
lefttime=setInterval("scrollmarquee()",20)
2 ?7 M# S5 _- F$ ?6 j$ g}
6 a" H5 T o9 m5 ~- Uwindow.onload=populate+ L) l4 L1 Y" d0 k3 v9 X; { l: Z6 l
/ |5 [: K' p! D" S& A2 `0 Hfunction scrollmarquee(){
$ b G7 ~4 t# M a* s; Hif (iedom){& d4 _8 `3 J4 z7 R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 J) c, \, a; u! } |, ~" Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" l/ a6 S* b$ {5 k% H* _2 Uelse
( O1 q! {9 ^6 d3 hcross_marquee.style.left=marqueewidth+8& B; m O- x3 Y0 G; J% V
* q5 R; P3 V# z}
7 x- D9 ^ Y! m R. M$ P' Jelse if (document.layers){) j5 \4 i0 n; c4 G' u9 t
if (ns_marquee.left>(actualwidth*(-1)+8))
9 ?! |, `3 p8 o4 b: Lns_marquee.left-=copyspeed
% v& Q* g# u/ ^7 f6 Qelse) o5 G$ G% |4 u+ }: Y- `9 y
ns_marquee.left=marqueewidth+8
`; m0 `& u. m! W4 G}6 L! \& @3 M5 Q1 |
}, y0 a/ C8 C1 ` a& V8 @- }
) B, k" I7 G3 d% U; } @5 }4 G
if (iedom||document.layers){
& y7 s' ~$ C/ J; P% xwith (document){& {- n. r F) X) P9 W+ ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 C( u7 l( N( p) s- g
if (iedom){ _9 _+ t' [+ o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ w" p; _6 D( j8 E% [( Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ _5 f7 i6 G0 v( G* _4 w$ E& I7 Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 @% F% W3 Q* l2 F, h, L5 d: Ewrite('</div>')
2 l( r' f0 v. s3 w7 L5 ~! S}
5 c. M* Z$ y5 _6 G. k: |' Yelse if (document.layers){
9 L$ r/ N3 c( e/ b5 [4 i g3 B( j( b" twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) h% F( h+ Q; _8 A) a4 l. i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" t/ |3 g+ t/ C& |; s# o* T" ]- d4 t
write('</ilayer>')
! |! }$ K) } R}
8 I6 C- j( t' O H" kdocument.write('</td></table>')
2 y. B6 E9 e; X}
. `( A" _5 i- u}/ Q1 Y7 N- D; H) ?+ Q3 d: n: S1 K
</script> |
|