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

|
网页之跑马灯文字特效
//修改宽度) c$ V' W% p+ w+ K+ U9 b
var marqueewidth=300
0 _* ?& C! ]2 N3 F6 w//高度
4 r; _/ K$ w' R% rvar marqueeheight=25
$ B W# g4 u O& m% [! z8 k0 ~1 r7 G//速度(1-10) J3 M. ^) K* u
var marqueespeed=3- W5 z t+ k4 g4 G( s! f4 R
//背景颜色" E0 j1 x4 R v/ F& ?: M
var marqueebgcolor="#FFFFFF"
& X% ]% g5 h! O* |//是否能暂停 (0=no. 1=yes)?+ S+ l9 k1 [8 @/ A7 ]% J& ^
var pauseit=1/ b4 ]& J; {* p
) A( n7 ~. n, I. r- e//修改显示内容
; u1 i' ^) `8 f% @& l9 Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; w6 B% }& i9 y8 m+ ~
" j8 {9 G" h. g* w# D4 I+ N, H6 M2 P: `7 A0 |6 k
////下面不需改变////////////+ W* M4 K/ O7 k- X1 }' ^, w& y
/ h$ i0 K! J( Q9 [) N
var copyspeed=marqueespeed6 L2 q* U P( ?! ~1 e, J( Z
var pausespeed=(pauseit==0)? copyspeed: 0
/ b- i7 j6 o. l& B- L, `' T/ t* Qvar iedom=document.all||document.getElementById
4 V! l& X2 R# J' E: r8 L' {2 }! X% Gif (iedom)6 T3 C9 r4 d* J+ ~ L' N, ?! T/ t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 S; A- k1 ^0 d* k7 Ovar actualwidth=''' t, \* ?; d" K. B" d
var cross_marquee, ns_marquee
D. G3 ]" E* O( }, a1 M. H/ s& X7 V. C: E7 y; T E, W+ I" ]' X8 V
function populate(){
3 R( f. z# y4 I- C5 g/ N5 q& _ V9 Kif (iedom){) q5 P- ^; R! n3 F) R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- T8 _ t4 S7 X/ X7 i! qcross_marquee.style.left=marqueewidth+8
9 N. h" n2 \+ H& p, ycross_marquee.innerHTML=marqueecontent
3 C8 X3 o- V3 Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 M0 G5 N* Q# g7 G2 F' u}
' O- }7 {/ N3 r* R- welse if (document.layers){
' s: H8 h7 z; F: m- |ns_marquee=document.ns_marquee.document.ns_marquee2 B* c4 N" z8 `* K/ u! {
ns_marquee.left=marqueewidth+8" v0 v# t( B+ V% P. }7 E4 ?3 A
ns_marquee.document.write(marqueecontent)
) E* R, V. c3 U3 \$ S3 U& {ns_marquee.document.close()# c2 h* p( W, _" W/ H& [
actualwidth=ns_marquee.document.width
; U) n$ R) {3 t+ J9 L% r}
w- a. L' u) _; s! J6 hlefttime=setInterval("scrollmarquee()",20)( }8 |5 _5 [" ~ q3 Q
}
+ h3 @1 m- d. P& E% cwindow.onload=populate
% P( [. m: A- M
6 U$ U& R# S8 d# Sfunction scrollmarquee(){
1 R, M- [/ G' D' v9 p) qif (iedom){5 d! W: E/ i: V9 I/ B7 G4 x* p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. P6 U! q( [: Y, V% J% l, E% w s! k [2 hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 R t$ q9 l/ }) E1 E
else- j% Q; I7 c/ }* r" |- P
cross_marquee.style.left=marqueewidth+82 q# q* v& |* D2 a9 ~( t- M9 f8 l5 V
3 v" I. Y0 @' @0 q
}$ ^/ a+ ~( i6 d5 N+ w" Q* E& ?
else if (document.layers){! ?7 q0 s5 a4 I! r* i0 ]7 x" c% [
if (ns_marquee.left>(actualwidth*(-1)+8))
9 x, v. W1 g9 ^- [/ ~) }ns_marquee.left-=copyspeed
o7 \# A: Z5 _% l# welse6 b7 `& C' `1 r) G
ns_marquee.left=marqueewidth+8
; _: Z# w2 S8 e K3 i& x}! i+ E3 Z' C0 X2 }/ d
}
% j" ^6 @6 T# L/ p; U2 Y3 D* P2 w6 U' U8 W, B& h) j3 g
if (iedom||document.layers){
9 x! z) ~9 S9 u" v" K- ]with (document){
; ^! e: ?, W$ Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 @5 o S: X1 T5 R2 S; Y3 s I1 Aif (iedom){! r0 _* H8 C$ T- i n# P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" D. a7 ?) k7 M# }5 ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* x4 l: i8 g7 |2 a5 Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 G, n1 Y; z9 L2 _" u$ a
write('</div>')
) N7 k# {) O; O% L+ |}2 |$ l' @; I0 O8 V0 g
else if (document.layers){* a( v. S' ~2 Y4 ]2 D/ \0 o3 V6 M; A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), U! n# l% C( o' i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 y9 F7 |& F- I: W1 p
write('</ilayer>')4 w1 O& M! i4 }- \/ B8 D7 Z5 V
}
8 {" J. u. Z& R/ I2 A+ F# Hdocument.write('</td></table>')2 e( G! b/ A$ ?3 U* A
}
9 S% m0 S3 b* L$ ^0 S}
' L9 W0 @7 u5 R. |4 }6 P</script> |
|