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

|
网页之跑马灯文字特效
//修改宽度# P3 y( a4 x' g u$ `$ h
var marqueewidth=300
" ^8 J: B; q. q: [+ P0 r$ C4 N//高度
$ ^% Z) a* a3 k" jvar marqueeheight=25
( m" S4 [( c* M4 R//速度(1-10)6 N2 |' w' w4 i+ M& T, u h9 b
var marqueespeed=3
% {% S3 z+ ]4 T; v, J+ j//背景颜色3 e c, z# S% G2 \6 I, E$ K: t
var marqueebgcolor="#FFFFFF"8 h5 v& c6 f' |* C( Q
//是否能暂停 (0=no. 1=yes)?
+ k+ Z2 L( W) C# Z; o( Tvar pauseit=1/ R6 G( A v( c$ f3 _
, |6 M' Q: O G! f3 \//修改显示内容1 M, [7 r9 o# _& E! y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 Z- s" l7 s8 A( y& U
) B K3 T3 K0 r# t
: |7 s9 C2 o3 W////下面不需改变////////////* _1 O; T6 Y6 p0 i
$ w2 z6 |; b; {1 E3 B( Ovar copyspeed=marqueespeed, R0 M2 g/ N, j, I9 Z- `2 {" M
var pausespeed=(pauseit==0)? copyspeed: 0
2 `1 Q/ u- T+ ]9 j+ q$ l) c2 Lvar iedom=document.all||document.getElementById
6 n1 k& ]0 x4 `8 Q$ Y/ j9 rif (iedom)0 F2 h" v0 |: j+ c( K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 `( u) y% p4 q! Y. l1 u/ c8 }
var actualwidth=''; O, m- |& k& D" Y
var cross_marquee, ns_marquee
" E( G( u' B) @* b! Q5 ?# t7 r) g0 j) B3 s/ x) f4 G& T
function populate(){
# o$ c3 K& z; ? H+ g+ Xif (iedom){; I! y7 p; [8 a X5 b6 d8 s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 A! X$ z9 C& a7 m7 F% D
cross_marquee.style.left=marqueewidth+8# b; q: A/ D) S7 M) G, ]6 ?7 B8 E' E
cross_marquee.innerHTML=marqueecontent9 F o' y4 Q8 N. L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 J, Y1 X" @5 m- A8 R}
# j" H7 Q6 z' Eelse if (document.layers){
; P' N# N6 r8 z, f8 p' Sns_marquee=document.ns_marquee.document.ns_marquee2
2 j* s- H1 y' w- u! e4 ~9 ]6 ans_marquee.left=marqueewidth+8
. J0 Q% o! K; M; {ns_marquee.document.write(marqueecontent)" D2 p5 n8 M& {# y
ns_marquee.document.close()
5 {; |5 |/ L1 }" K6 Q7 ]) zactualwidth=ns_marquee.document.width
* g7 K) M4 x [- d: x# K}" R, h3 y4 g. y9 [. o/ }$ p
lefttime=setInterval("scrollmarquee()",20)
" h7 B# I4 \' ^}
. B' h% t7 I2 m# Hwindow.onload=populate% \: b0 U% ^# D
/ X/ A2 s8 V) G* t7 {# kfunction scrollmarquee(){. C( _3 u6 e( f6 K* J4 c% @
if (iedom){2 N. I9 D( @% b- T" g
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* }: \; o* x9 g, S$ ~7 }7 u1 Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ f$ M: a. N8 belse
4 S/ p1 X2 A: G! s/ ]' across_marquee.style.left=marqueewidth+8
5 ], \) P7 M. f8 F) W3 `1 n$ {; X0 n# B6 n9 {4 B
}
5 T1 o$ G2 h+ x$ ]" f J$ Selse if (document.layers){1 {' D2 c0 u7 J" I* p: L+ i
if (ns_marquee.left>(actualwidth*(-1)+8))) e7 R# o4 }. C. Z( X' p
ns_marquee.left-=copyspeed( x( s( X+ R9 h1 G( B
else
4 W$ o; F* w' P: ?3 K6 Qns_marquee.left=marqueewidth+8& W& ?# h. z3 ~9 y: N# C! o" O
}9 [, N% Q: l1 x- L5 [1 k" s& _
}0 T) U+ K" U3 O ?
) H8 ~5 \ b$ M, Xif (iedom||document.layers){
3 H; i& X. E4 Cwith (document){5 \: m3 N" x" d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( u; A# y8 B7 z3 oif (iedom){+ U' Q" T/ z. L* p, d5 e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) ~( T y) u: E5 U& Z! S& p' [ G+ Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 y+ ^4 @+ k7 p" u0 ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 o* u. a' s* j9 c( z
write('</div>'): x) }7 M2 }/ n
}) k8 z0 ]- r8 B7 i/ O; [
else if (document.layers){
" j! N! N% \1 b5 U! I3 cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); `, R% n S1 L) ~( W+ Q; [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ {% C% c# g" J" d1 C
write('</ilayer>')
( S) {- P1 K0 A}2 `: T2 N: }$ s6 s! g
document.write('</td></table>')
, n, O" V8 H8 f# l}
0 o) M9 ^, {9 S. l: [+ ?# \( F}
: u$ U8 k# j' Y) p. x3 A2 x</script> |
|