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

|
网页之跑马灯文字特效
//修改宽度( k) V4 P2 D- ^1 n6 y2 ~9 |
var marqueewidth=300
, l9 l4 g1 \1 Y7 W: J+ }//高度
- o) \0 g9 Q6 N3 n; I3 P- Gvar marqueeheight=25; q8 Q4 `& t" d; |& b& m4 s/ i
//速度(1-10)/ i/ Z' Y) L2 f8 V& r
var marqueespeed=3
( o! _0 k$ |1 U* q//背景颜色2 i/ s$ Z* ^( p' x3 D
var marqueebgcolor="#FFFFFF"0 q; O2 | u0 y9 e
//是否能暂停 (0=no. 1=yes)?
- t( a X$ ?# s xvar pauseit=12 t9 ?. L1 E& I% @, i6 I+ a
7 X( i# Y! v" k! i1 F: M
//修改显示内容
% _! q8 W8 @% T; `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* O, L5 Y# A6 e: G, O! ^/ _- K5 f3 i3 R4 B6 a3 [. a
9 k! D* f, `2 X) |
////下面不需改变////////////
4 S- q& U, g) k, `. y* l. R: j3 _# c7 y8 u" {' @7 l
var copyspeed=marqueespeed1 `; Z, `9 P( ~% x( P3 U1 Z) p0 G
var pausespeed=(pauseit==0)? copyspeed: 0+ n% {! _' |! R( n7 b& s' K0 f
var iedom=document.all||document.getElementById
: \7 v; A. F' R: h, }' zif (iedom)
- }& a* L6 C! X( q. s: f1 |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 s, T; S/ w( m0 s
var actualwidth='': y9 b( }% o! Z
var cross_marquee, ns_marquee# o- y! @: ?/ C# t
2 ~9 W) Q; \' O) z# g8 ^. Ufunction populate(){8 L* `; e* y2 e$ `$ g
if (iedom){: s! k% a! W) v" O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. v* V9 ?6 x- @3 }1 Y
cross_marquee.style.left=marqueewidth+8
) _ X# T4 J3 w4 g; n# |/ W3 N. ^cross_marquee.innerHTML=marqueecontent
* a0 r4 y5 u2 E; oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# S- N+ s/ Q/ _}2 E3 q; w V4 r- @
else if (document.layers){
B4 _) A' k% w$ p5 p' Q; _' @ns_marquee=document.ns_marquee.document.ns_marquee2
4 c- R/ P; k$ q6 y$ F( {ns_marquee.left=marqueewidth+8
; Q6 Q6 x' y: B" i- {4 K/ Pns_marquee.document.write(marqueecontent)( U/ |7 B% r1 y* i1 ?2 a
ns_marquee.document.close()
" m, V; q$ `( sactualwidth=ns_marquee.document.width
0 A4 G( f$ m: C/ R* a}7 q9 i' t( b) K9 h( ^
lefttime=setInterval("scrollmarquee()",20)* X( b5 H3 J6 D: R
}
2 H d( B6 ?" L1 Fwindow.onload=populate
l1 f% B0 I5 X1 i$ M9 N6 L' E5 S! @ z( b, o
function scrollmarquee(){4 r' P3 w9 C$ H* p& Z$ ?3 N
if (iedom){- ^9 T7 G P8 J: Q5 w' k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 u6 ^5 } w0 P: h t6 W' v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: Y1 C+ _: |& w# yelse4 O! j4 Y J+ n
cross_marquee.style.left=marqueewidth+8# P1 T# ~: t$ j9 ~9 e: N# W
( C& N8 F+ a/ W- v. r! R1 x}
?/ Z4 |' A; M* Relse if (document.layers){1 z- x# l* e+ _& e( [4 ^
if (ns_marquee.left>(actualwidth*(-1)+8))5 B3 m, b2 o S( p0 z9 @ t
ns_marquee.left-=copyspeed9 _# e8 {0 n& a
else5 L) |/ k# n g' N9 E
ns_marquee.left=marqueewidth+8
; T1 C9 q5 r' Z2 x1 p}
+ t' F1 D# N; \ a7 w" K5 E- F s y}1 ?# K$ y7 d' M! w3 k* C& m
8 S1 Z/ w1 v1 B- `if (iedom||document.layers){
8 a: U! N; T2 H' N/ ^9 J( @5 }with (document){2 \5 J. y1 O9 D! D' [0 |% Q4 z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# w: v# H' w0 e6 z9 M* gif (iedom){3 v1 @# C- j. U1 M" R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" e- D* v3 Q4 S4 _7 y+ g ?& a% fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, B# O5 ?" H1 d! \, F Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' @) b7 c% Z9 t9 d" l' _
write('</div>')
9 M" L6 c# f+ y& m6 L}
1 @" Z" a0 _6 o, n% e4 e# N$ R+ |) Gelse if (document.layers){
6 T/ V5 T4 U2 f! l6 mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). }+ l. b! Y# e, O# P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: r0 ]+ k7 V0 n# p0 H6 R7 Pwrite('</ilayer>'); m. |# U% B; f# \( `; v! ~
}
: M7 u- d2 k: ]) v& _6 Y+ ndocument.write('</td></table>')
5 `0 N2 [2 T% Y}
/ ~) C x( G+ A}. Q8 u7 ^5 T. K: Q. e
</script> |
|