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

|
网页之跑马灯文字特效
//修改宽度+ Y4 t- Y- o% @& ~% G" r. S8 Y
var marqueewidth=3002 a' n- |$ Q% v- h0 @0 X6 w6 a
//高度9 e/ d1 U# |! i# e+ Z
var marqueeheight=259 O& s( E( G m' }
//速度(1-10)
% \1 s+ s" p( l8 x6 _var marqueespeed=3
- k9 a: z4 Q3 n9 F o//背景颜色
5 Q6 W6 X! C4 z4 W, mvar marqueebgcolor="#FFFFFF" V$ }9 ]6 S5 o3 {3 d3 O
//是否能暂停 (0=no. 1=yes)?
$ p6 \) K. g; u# \ Bvar pauseit=19 |! l8 e, a+ I# b1 ~
/ ?5 Q( [# u; S9 I7 |. u, K
//修改显示内容6 m8 A0 B B+ ~, ]/ @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 |! Y& E( s! |* J; f8 f l8 G/ y: f1 ^! X4 `. F7 [# I- W8 c
6 O6 t" T! a5 \# \
////下面不需改变////////////
: [ i7 `. T5 V4 X2 |
/ i8 r7 Q: w" `' `1 |: {var copyspeed=marqueespeed$ j b5 f5 F0 b' M5 t$ w7 D8 d
var pausespeed=(pauseit==0)? copyspeed: 0) L) q8 J7 f- o9 [0 S3 B1 L$ j
var iedom=document.all||document.getElementById
* c! d0 ]0 r: a }% d! p: eif (iedom)
* b" b* d& u$ [6 B: Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 z9 W! \' c$ zvar actualwidth=''
! v1 T6 e1 C- a' ~* y( nvar cross_marquee, ns_marquee
# M! c+ ^0 ^4 E. M3 S
9 k* L; S0 O+ f1 D- p4 Jfunction populate(){
5 `: ~- @7 {* A; {3 V7 W% k! Jif (iedom){% }" \$ R; c, e" B% N* A0 d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; N! w3 U- X/ U- S% I' r
cross_marquee.style.left=marqueewidth+8! e1 ?6 q; r( R; Y# t4 L
cross_marquee.innerHTML=marqueecontent
5 _7 l( I7 ~$ Z# p8 Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ Q6 M1 T, R# b! g5 I. f: S2 k}
8 f, p- y, K( n9 n, a" t6 qelse if (document.layers){
$ ^) \5 r+ t, l0 P- w4 b. cns_marquee=document.ns_marquee.document.ns_marquee2
* [4 `2 a: C9 a6 h6 `( ins_marquee.left=marqueewidth+8
! E4 V- X5 Q* I; N4 ^/ u, R+ ~ns_marquee.document.write(marqueecontent): r7 n: {( t* c1 J8 V
ns_marquee.document.close()8 ?9 d1 @! ^0 H$ q7 t8 u
actualwidth=ns_marquee.document.width; P) m% |: n0 Z+ b
}+ m5 P& {+ |# O0 O
lefttime=setInterval("scrollmarquee()",20)
0 e7 A' v% q- w3 z+ Q% G, F: y+ @}7 h. u+ Y# B9 `# d; k8 ?! [
window.onload=populate) d1 @0 p+ b& \1 Q( @6 }! h3 k7 Z
; y; x2 T- f% X6 Y" g1 ?2 h5 Ufunction scrollmarquee(){3 {9 K' M4 C) X0 c; P! R& I# r
if (iedom){' @# ^, f: Y$ K- F% p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. z5 c! U5 U& vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- q3 k+ v V( c2 Telse) n& R- Y; s) Q
cross_marquee.style.left=marqueewidth+8; u3 E( d. |) X& }- M8 h
' a h( k6 E0 k2 m+ P
}/ h) t! B6 V% C2 t
else if (document.layers){
& B$ c8 S: \. k( fif (ns_marquee.left>(actualwidth*(-1)+8))8 I) A/ t7 V5 y
ns_marquee.left-=copyspeed
1 ]& i3 j3 _, _9 Zelse0 W: N) S4 M3 G% W' }$ g
ns_marquee.left=marqueewidth+8
( m) U1 F. P |7 N7 i7 z" K- q, W/ J}% j! A+ v. m- I4 v. I/ V
}
* E' S7 C/ |! v3 s8 v
( P# ^# R7 d0 I. ]3 f- ~& ~1 Lif (iedom||document.layers){8 {5 S* R' w+ U0 p9 x
with (document){
4 Y1 j5 ~0 f# z" u, ]% fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>') W& b4 b# o1 I' P, B2 i
if (iedom){! ]- B$ t5 J5 a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& o- W+ J1 \/ Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* ]! U7 v* V$ i+ e, f( bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 w, U( y! e6 J3 i" i& T# Q$ H$ Ywrite('</div>')' s# f" o2 t( ~' x4 i" ]: C3 f/ b
}
! o/ H1 P- v" S: ~else if (document.layers){9 D& X8 e* `- B7 @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 B& m9 _# {) k: y/ y" ?# Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). U) d( ]% A) v1 S* b) T+ i
write('</ilayer>')
$ S2 ^+ S6 G' y5 ^( n; @}
% v+ ^( O( C6 C3 z+ y* R2 n# Q* ndocument.write('</td></table>') }8 d2 T2 `" Z* b
}
8 ]5 N1 p2 ~4 P5 K}
7 P7 ?8 N7 l, w6 q, r' ]8 j& ?! a</script> |
|