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

|
网页之跑马灯文字特效
//修改宽度9 ]) D0 X: u- p$ o; L; O
var marqueewidth=300
+ M" ^4 m4 _: Q9 y# g1 I- J//高度
6 z1 t \* m+ }) n" Xvar marqueeheight=255 O v5 d" P6 `1 G. q
//速度(1-10)5 }, I% e$ f2 D/ |' `# x. X; E# I% n
var marqueespeed=3' J( ^6 x& V- r
//背景颜色
( w0 _3 p, `$ u- Ivar marqueebgcolor="#FFFFFF"# [$ W0 s! h9 e1 i* f
//是否能暂停 (0=no. 1=yes)?
* s* \: E- E1 m3 b6 ]var pauseit=1( Y2 r9 ?- A- C
- H0 k) i' x( h8 W7 y//修改显示内容
0 ~$ b2 P2 e# Wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' e2 K$ m7 a( R! a
: y' t! v; y6 [6 \! s4 T/ M7 x) P+ c/ U& P9 k/ z0 L
////下面不需改变////////////
# E9 P$ X* r7 L l7 b: m% O7 e. |
var copyspeed=marqueespeed
' q6 P5 s- k" K7 w$ w+ Gvar pausespeed=(pauseit==0)? copyspeed: 0) G5 ?: O( d1 y) O+ D7 Q
var iedom=document.all||document.getElementById
" Z$ J/ G( R, n3 \& e8 Uif (iedom)
4 F& x$ O$ T" [! w0 C* Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 A1 V; T5 Q5 J1 W" Jvar actualwidth=''2 D" h* b. Z( a* e/ k
var cross_marquee, ns_marquee
( T! P7 E; R; w" q: L* k, [. [6 g8 D2 ^
. m* r) H9 z$ I1 }( a! |" lfunction populate(){
# x! k" s3 j. h) A- r; \7 rif (iedom){( y' N9 v0 |! t1 k+ ~) f; X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 R6 C2 w. m( }9 q* Wcross_marquee.style.left=marqueewidth+8
% S/ z# L9 i7 Across_marquee.innerHTML=marqueecontent
' q- a7 w3 Y* \, H, Y% J, _6 qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 i/ i* j2 _8 ^1 I
}
5 a- A9 o. ]; }! ^. uelse if (document.layers){
/ \& o4 x$ X$ z& S3 Sns_marquee=document.ns_marquee.document.ns_marquee25 f7 G1 e; \; L( @/ c7 R) F
ns_marquee.left=marqueewidth+8
) v( J! U5 y5 u. o$ m# j4 cns_marquee.document.write(marqueecontent)$ V D7 p+ d: ?7 d) L3 e _
ns_marquee.document.close()
D% \7 m& C9 j! }6 Sactualwidth=ns_marquee.document.width- Z2 q+ ^" I( Q- V+ i1 j) E: U, l
}
) L. B2 g7 O9 Z. X A t3 zlefttime=setInterval("scrollmarquee()",20)
7 X* O" J$ q! E( `. v}
; E2 G' Q# ~% E. U% I$ Awindow.onload=populate
7 W) j6 w( u2 e: a* b; u# x, K
' h% a9 s- A0 v6 s' | b+ Jfunction scrollmarquee(){0 ?" M6 k4 [! k i4 q
if (iedom){
) O' @8 t7 a/ ? s4 X6 ?2 u" M' |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 z$ }/ | Z; W5 U1 u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, J0 j; u) |" E. B2 j
else
) [% t. N8 Y3 e8 P# t0 J) L) W8 K9 c6 {cross_marquee.style.left=marqueewidth+8
: } b* C# {7 K' c
. W4 d; s9 J0 Q3 M/ e% x( g- K! N}
; ]; k0 V6 _/ velse if (document.layers){4 S) p$ r) V; ~( g% }
if (ns_marquee.left>(actualwidth*(-1)+8))4 r# Y( S: C5 s& K# D
ns_marquee.left-=copyspeed
* B" k) R$ \0 r9 k" ^else
3 W2 {6 X2 M: ^9 ~; D! c! `ns_marquee.left=marqueewidth+8! c, D9 z6 A, k1 R% `# Y
}
; k2 ~% j) v8 x" o8 r}
$ |3 Q$ O& D$ {* j. C2 W% V$ A2 g* `3 F$ g& _) m; P q
if (iedom||document.layers){
, I" {9 C8 b! [4 v' Dwith (document){
' i/ Q! c+ w% h$ Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) \3 g1 f3 d( { Z( xif (iedom){
- ?1 ]' j* x, _( C! `3 R5 ~; T6 Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" M5 P9 l6 `! Q* h9 E3 Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- Q5 m9 x& q) j+ b" V6 P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& h( v) t4 Z; d. M. g' q4 s0 [write('</div>') Q4 Z9 ?% b/ E- Z
}- ^* \: n' \- m. I) O6 R
else if (document.layers){" l' f! ^) J, P$ }% e/ c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" T W2 Y! |+ K+ K* U. r: `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 M/ r2 W. V% G% F% F, @7 H4 _write('</ilayer>')! R I# n0 ~ [0 Q: Q
}
, k$ @+ ?. f1 sdocument.write('</td></table>')
, k+ X7 s0 I) X% t}; y7 z% f8 m. F5 w1 r3 _$ B
}
& r8 C4 X2 h1 |* @% @</script> |
|