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

|
网页之跑马灯文字特效
//修改宽度! L1 F) \7 t* D+ C" f
var marqueewidth=300
2 g d5 G5 i1 ?/ {0 w: A* U//高度, S2 O% |8 m, u8 R. \# E) C* p% C0 A
var marqueeheight=25# |9 x9 y0 p7 o* `/ T7 I" J
//速度(1-10)
* V8 _: ?5 K( }* z; G4 k( a0 ivar marqueespeed=3
9 a: R+ _/ N) |* h- K//背景颜色* G7 [9 V( m+ `5 q ~ s
var marqueebgcolor="#FFFFFF"
# W% b" |$ Z+ e/ V" \1 {//是否能暂停 (0=no. 1=yes)?/ _9 H/ H' Y8 _6 |% l/ m: I
var pauseit=1
4 K' A s- v' v* R& ^8 N$ T3 W/ R" R! S& d
//修改显示内容
& ]" h6 L7 Y2 B1 P' Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: q/ h$ o0 c* i
0 S% n/ V4 a+ ]/ ]+ B$ ]& j
/ _ e$ r5 M! _& w6 h////下面不需改变////////////5 t" i9 G: I: f$ u) F
! l8 [$ n9 {7 K5 m9 Pvar copyspeed=marqueespeed$ R5 ]) @7 |; D6 g9 C# f
var pausespeed=(pauseit==0)? copyspeed: 0
5 y6 V; l- N* u- O% l4 n: i; ]var iedom=document.all||document.getElementById
, u/ y. |3 _( a3 Iif (iedom), w3 J8 \! X" d" e+ F2 R! ]2 Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ e8 x7 {& M: `
var actualwidth=''
& u) r4 S% D: c G0 ovar cross_marquee, ns_marquee
H: Z; x' z, V: Y" v1 w( T8 Y6 d) N9 ]
function populate(){5 X# }8 H$ R: f: @- P2 {
if (iedom){
. ^' a% N9 i$ \+ e8 E4 tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. I3 ?: p/ @& [, b
cross_marquee.style.left=marqueewidth+8
* z! K2 k: u0 a+ [' Ocross_marquee.innerHTML=marqueecontent
$ _0 u" h% h( b6 D" ?8 Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 T: F% z+ k" u! `- ^4 r}
3 l) S( z. t4 {( relse if (document.layers){: _* s4 ~: r& N/ i3 E& O
ns_marquee=document.ns_marquee.document.ns_marquee2# X7 \$ T) X! z$ G: y; ^) r
ns_marquee.left=marqueewidth+86 `: h+ V* q F* E% F- [ B" h
ns_marquee.document.write(marqueecontent)) s7 v, G( m# C* R
ns_marquee.document.close()
8 s- _& ?: O" X; f( xactualwidth=ns_marquee.document.width
" M [) k3 W' N0 _6 N# \. X}( n8 z. F/ z' T# r k0 K
lefttime=setInterval("scrollmarquee()",20); C6 P% B9 g/ h1 ~$ [2 [4 H
}
( P# w3 T9 u. P9 @/ A9 |window.onload=populate7 d2 k$ d/ t- s6 Q! I2 [8 |5 M
, M/ q! p. d. l$ j4 g9 _function scrollmarquee(){7 T6 t' L6 k, ^& }
if (iedom){
W7 \* z! B. o% y2 Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, J; L$ S. z& g g% e' P" Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 k7 i( N; |$ a5 q$ M$ O: p; M8 `
else* K+ @# t2 j0 } A
cross_marquee.style.left=marqueewidth+8
# q) e* a# `# c# C/ X0 ~9 S% ^% L9 Y e
}$ I* s; k# @7 M* p: h* ^3 w; }
else if (document.layers){/ K& ?! a% |! W/ h- R6 t
if (ns_marquee.left>(actualwidth*(-1)+8))
+ P% S8 W" _: t( w7 S3 ^ns_marquee.left-=copyspeed) l; c f6 B$ v5 D( i% i: l
else! B& r$ P1 x3 T4 m
ns_marquee.left=marqueewidth+87 i6 Q5 L0 y; V4 F
}
4 b% k/ A* T$ D7 z4 [}6 Z& X0 k7 }# ]
; {3 j+ c$ T8 |* V2 Q- t
if (iedom||document.layers){9 }- P% J1 E% Z( z# M" \
with (document){
$ d) h' Z4 i0 F4 h5 V! |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: c& Z0 L" p* t f4 \5 z" a1 }: Oif (iedom){
) l; T' r" o7 Q8 owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- q; N: [4 e+ h. L) c8 l- D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 Y$ a2 k* ]6 D9 Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. p f- C% |% f( f1 `6 A+ [write('</div>'): M& W7 v4 T* x1 F
}- X* t2 ~# Y6 E) `6 K
else if (document.layers){5 n; H. ~* h& w8 n$ a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) S! b% ?5 R7 O$ Y: `# O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' d+ D0 Y7 o' a9 i4 r t' @! I0 o; gwrite('</ilayer>')$ h0 `, `/ M, G1 s
}2 Y9 w7 {4 C& m! `
document.write('</td></table>')2 I$ ?! P* N1 x6 w9 K- ^
}
' |5 i7 v6 Q# W% }1 d& r}
+ E2 p6 a- @/ v8 D' X% C</script> |
|