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

|
网页之跑马灯文字特效
//修改宽度; J* N0 R- Z7 `2 `/ v$ Z
var marqueewidth=300
, E# h$ Y3 l# ?- X$ D' w//高度4 _7 g3 ~2 j0 w4 ~
var marqueeheight=25
0 y; p) r. j" e- E# m4 C& v- p; U//速度(1-10)
8 `1 q- Q$ s- J4 i: H9 zvar marqueespeed=32 F6 u# j9 @# Y5 c0 \: P, }
//背景颜色
- T$ p o( t g9 d2 zvar marqueebgcolor="#FFFFFF": w4 D# W/ d3 N+ k/ m7 p* s) D
//是否能暂停 (0=no. 1=yes)?
( r+ _3 ]! |* \. H3 a3 jvar pauseit=18 m: H# d. Z5 G7 X- i
0 D4 G! S8 G( s- B//修改显示内容& Z) n+ ~2 o) t/ p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 ~* R5 _+ }5 q; \/ z
% {- \7 `+ A R+ b2 a4 Z
$ A1 t/ b( P7 p. i! L////下面不需改变////////////
( Z! {& X$ \+ Q9 o; z* f
, K7 G+ y @9 @7 vvar copyspeed=marqueespeed
5 T. B0 m" }% Nvar pausespeed=(pauseit==0)? copyspeed: 0
. E- [: @9 i3 e" g' hvar iedom=document.all||document.getElementById: U$ g% p1 n \
if (iedom)7 _# ]& K% x9 l1 Q/ @7 W5 b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( j4 ~1 w. e8 I' I; \5 Cvar actualwidth=''* |. O* Q5 {; S. k% s" E3 a
var cross_marquee, ns_marquee
5 t- Y9 j! z# Z$ o1 x7 j K+ Y) U1 \' O+ f! ?" D X4 B6 i
function populate(){; \2 ^% S; X+ Q9 C8 y- Z
if (iedom){
: @: W( @# [0 y( L$ ]9 l: rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) E% y! Z0 j* Ccross_marquee.style.left=marqueewidth+8
+ X8 g/ q2 p: p7 qcross_marquee.innerHTML=marqueecontent2 N4 ^1 T3 y% s: K& c5 u- j+ g) C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& V+ [' t1 ?. F G% b
}
2 v7 ^( }2 |, ?2 X, |; G$ Melse if (document.layers){% O. D3 M# L( }8 P" q
ns_marquee=document.ns_marquee.document.ns_marquee2% ]; m4 x; l, N: h
ns_marquee.left=marqueewidth+8) V$ X: t8 H( I- Y6 v0 G
ns_marquee.document.write(marqueecontent)
0 Y% J/ N5 Q! N, i" K5 Y- cns_marquee.document.close()
, m; _ u3 c1 u7 }1 Zactualwidth=ns_marquee.document.width
- U: [+ S$ D$ y: ]0 l}2 p4 X5 z, ]' k
lefttime=setInterval("scrollmarquee()",20)
$ o+ j$ D9 C1 N7 X9 v4 w. |' h}
6 \' q9 z. }7 q7 e4 Awindow.onload=populate
% f) @$ Z0 H/ ]( K3 d9 A9 p" `3 D, P! z$ g
function scrollmarquee(){5 m' e+ ~4 u0 G1 u* W3 R
if (iedom){" y9 ?* w' b) k- m- [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 E% j2 h' R, }5 I0 ~9 G1 ?* L, [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 u: z+ b# f6 L9 [7 B! |& y
else
+ F7 {$ p; t9 n, ]cross_marquee.style.left=marqueewidth+8
3 P: S& _- J8 l' A2 V6 S/ ~( N* K( f* G# c+ n9 g5 q
}
M. {! X2 Q2 W- x: aelse if (document.layers){
' |" B* `6 `0 _+ m- cif (ns_marquee.left>(actualwidth*(-1)+8))6 A: |) b( _. B
ns_marquee.left-=copyspeed
6 B, v$ S: E; u! z' ]8 Nelse
- \. |5 {+ W9 E% pns_marquee.left=marqueewidth+87 S' r4 x3 }3 x
}8 \" S, W2 _' ~1 S% m+ j; Z0 S
}$ L- |3 K4 T: X3 R
4 _6 K+ P3 s5 \, u# x% j: oif (iedom||document.layers){9 m! v% }. z- U1 J
with (document){
1 K e# E( w; U8 Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 z p" u) u3 h$ H. U
if (iedom){
! R: _8 k& x2 ~1 m8 X# awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 g# |6 @1 {* U+ P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 W* B9 y; O. j0 @+ twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! ?. Y9 e& c; d& N: x' [1 i4 R
write('</div>')9 I/ z2 J& W. l, W+ @
}
' u: o# }2 u- @" ~- N5 eelse if (document.layers){
; ~" ]5 e9 G5 S f$ gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ z0 Y" f! D; n0 Z( u+ W9 Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 o7 }' `! U3 k$ y! l$ Z
write('</ilayer>')3 m) J, E* n" r6 `. C
}3 Q9 X. U. Y3 @# s) [
document.write('</td></table>')! @, {$ B2 p3 b4 D+ D w) N0 I8 D
}
4 G- g% |+ e( E+ J2 U}0 ^. d: l8 \# e+ U
</script> |
|