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

|
网页之跑马灯文字特效
//修改宽度' {7 h' I* G2 v! T
var marqueewidth=300
( Y8 f# v+ y' f4 T' d//高度4 H' L: _4 U* a9 u, J( i" f- S# }& K
var marqueeheight=252 `! x+ \4 Q0 \ L4 G- X
//速度(1-10)) H% p5 r5 D$ L% M
var marqueespeed=3
' z q! s2 C$ H0 r+ q( f//背景颜色7 ~6 Q9 E$ H* j6 j2 h# u
var marqueebgcolor="#FFFFFF"
+ |- H0 [5 C9 t! k+ n5 F//是否能暂停 (0=no. 1=yes)?
. S( a) f3 z" @1 F3 |" e- Mvar pauseit=1( D; O$ t, Q0 |7 U+ R5 b
1 i3 j* W' Z/ R# d9 U+ y
//修改显示内容
7 V) M& K1 i% u* V3 Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ o# P/ t R" z+ }
7 M' [% w& x% F- m8 y5 _ f% Y; P2 n2 _& e; y# m
////下面不需改变////////////, p/ \& w# O$ b0 `/ `1 l+ [
0 u/ m/ n" t0 X% f8 P
var copyspeed=marqueespeed9 z) A& u- g5 A, S
var pausespeed=(pauseit==0)? copyspeed: 0
3 W& p+ ?, n; ]+ N# o% d" w% t+ Evar iedom=document.all||document.getElementById
2 z, @- j# Y. Aif (iedom)
+ w7 H" C V; S! R4 gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), D+ X& j4 b- ?2 O8 ]4 X- U, e
var actualwidth=''( f$ H& S1 U5 r T5 N5 @ m# p, L
var cross_marquee, ns_marquee
: m% H9 z2 {; Z; S3 ^ i/ B8 I! c/ F* D" r1 g; Q3 R, d5 @- C
function populate(){
* q$ U4 {( h3 R9 }6 Jif (iedom){4 t+ A+ G( |2 ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; I8 e F/ v! A, ucross_marquee.style.left=marqueewidth+8
- l( V0 \' x) m7 w7 o; ]2 q j$ ]# Zcross_marquee.innerHTML=marqueecontent( n% g( e: K) S/ l4 T! C, R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: v; B. e5 y9 [; T l, V) s}
6 ^4 n Y, M5 {. q, S/ L# Zelse if (document.layers){# G8 }+ G) |1 Z6 M
ns_marquee=document.ns_marquee.document.ns_marquee2
/ Z; N: D) `$ y- n9 P7 ^ns_marquee.left=marqueewidth+80 L1 t5 q) l* w$ i2 t" U) ]( J
ns_marquee.document.write(marqueecontent)* h. A \6 \1 B- P) W
ns_marquee.document.close()) r# z: r$ R7 f! c! R7 \
actualwidth=ns_marquee.document.width1 V' B: K, N2 ?$ d; W: y
}
+ w4 T" z/ P \; Zlefttime=setInterval("scrollmarquee()",20)4 r5 b& X$ j/ M% Q$ W
} N8 H0 a( n' Y' ]& A4 {
window.onload=populate1 j% p5 {9 q( ^+ }
( D( _* q5 n1 y- S" T
function scrollmarquee(){
w+ h# O$ G' Z2 }# Y% Fif (iedom){
! S( l9 I( t8 \/ h; Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ X# V7 b) g: M7 ~+ k7 L/ icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' M( N1 L' v( r, y' Xelse
8 _ I" @) h" Tcross_marquee.style.left=marqueewidth+8
$ g$ q0 q' V9 V3 w9 C: }
; s; u: p- ?% r/ u/ a6 [8 a4 V}. d' o. O8 Q' L) b. O+ P
else if (document.layers){% Q, E/ J# E& f& W8 G# D
if (ns_marquee.left>(actualwidth*(-1)+8))
9 T$ l; O/ R# M/ b0 cns_marquee.left-=copyspeed0 v6 r1 |8 d6 R) @4 b; [7 G
else
" r8 M0 Z# x3 h! J$ D7 s& H! ?ns_marquee.left=marqueewidth+8 g$ v* h7 F# }4 G _3 n4 j4 ~
}
/ r* a: a/ G$ {! u% ~}, S8 }' h$ A% P2 O% @, F( m
) Q9 W8 C# k3 M2 d; X* N1 P
if (iedom||document.layers){
6 B1 N) Q' S4 _! h4 p; _0 Kwith (document){! u0 J: N# H" q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ x( P$ p) b4 ~* mif (iedom){
. D# e3 E+ k6 I6 T- w; O( a1 N6 Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' p P( u: N9 T! f6 D- K; m: i- P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& Q% q9 C5 g4 D# B# L' T, ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) {! i- ^' M g$ u% X2 I! f
write('</div>')
# Q+ _! F* g, D! ~; a! |* N}8 h i) X; ^5 S" n& C
else if (document.layers){
- V9 a8 {6 M* A( owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' F% k1 _ j$ l5 R) k3 C9 Q+ nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 y5 W- M# ]. R! f1 z: z/ _
write('</ilayer>')
# {( @' M* K7 K, x}2 ?/ V; n5 ~! H! z, h9 v
document.write('</td></table>')% j. ^1 A3 M4 j% J9 g
}9 l4 Y0 F J8 E5 F; ?/ V. ` { P
}4 b; {1 M+ |0 ^5 ]7 q$ p
</script> |
|