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

|
网页之跑马灯文字特效
//修改宽度. ?/ I& h5 N1 { X) m
var marqueewidth=300* N- w$ ]# t' a6 r8 _! O
//高度: J8 ^% O4 N8 t( c& F6 y
var marqueeheight=25' [2 H" Y( D6 ?5 N
//速度(1-10); m' S+ d/ m8 |* t, }- G+ `9 ?6 B
var marqueespeed=3
! S' k! }8 ?, Q7 @' |1 K//背景颜色
5 b6 _- i* k. v6 s& [% r# ~var marqueebgcolor="#FFFFFF", i; Z3 s8 d: L) p3 u, L! Y4 c
//是否能暂停 (0=no. 1=yes)?0 b2 M4 I3 b* [( Y3 r4 Y: b; u1 F
var pauseit=1: c; y7 T# ?6 F. t
J H1 g8 N! Y( M7 p& ~! ^//修改显示内容
& g1 {$ u$ v- \: Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 W& Z8 E0 _- [$ n+ F4 ?6 H/ x w1 a# l6 {
$ g9 F& ^: p% q- l0 j* h1 B/ ]
////下面不需改变////////////! {& ^. N# z* \5 l# J& g4 \, c. K) h
# h k7 ^) W' D9 V2 v9 w# i# G
var copyspeed=marqueespeed
5 W, D: P/ o2 ?% }4 z3 s! H0 E# y+ [var pausespeed=(pauseit==0)? copyspeed: 02 h/ e. F Q) W6 k
var iedom=document.all||document.getElementById: D, t$ a Y0 ?& ^
if (iedom)
; _ O1 e8 }1 P) r& Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ k$ y0 h/ \. U5 T. G' l9 J
var actualwidth=''
4 Y" x( N: k1 i& l3 U+ A g7 vvar cross_marquee, ns_marquee+ Z) J: y; }0 e* C+ B R" F" ^
) h( F. m2 S: M6 h- I" k) w( p7 mfunction populate(){2 Q! x7 m1 B! M/ O5 \9 C
if (iedom){7 b0 u+ t7 O+ |3 k3 f: K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* S# c, v% e) a) Y* f Lcross_marquee.style.left=marqueewidth+8( k6 Q* j }& d' p: r
cross_marquee.innerHTML=marqueecontent
8 O2 Q: h% `3 S" A& xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 k8 F" t7 k8 Q5 x& m: `, o
}2 f6 P6 {, {/ k$ N
else if (document.layers){0 \# v. d: Z* O* z
ns_marquee=document.ns_marquee.document.ns_marquee2
1 p7 v, _$ y5 Y* V% vns_marquee.left=marqueewidth+8+ z9 |5 J' ~1 e2 S
ns_marquee.document.write(marqueecontent)
( s, f3 l" Z3 x# R9 F$ J4 A! Xns_marquee.document.close()) Z0 w: J: N. C3 @
actualwidth=ns_marquee.document.width
0 ?# f# d3 G7 c, E% h}
0 _% G3 D4 ^" H( ]: b2 S' Y% Jlefttime=setInterval("scrollmarquee()",20)0 _0 b7 ?0 [1 }/ V. |; u
}( W8 v. r" ]7 I3 Q! p! i3 C" d
window.onload=populate
5 F h5 r( r/ f: o
! D* Z4 C3 i" vfunction scrollmarquee(){
$ k' j" x8 l$ w \/ d9 Y7 T1 w& Uif (iedom){
3 i% L3 G$ n# }9 @4 G* |% wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 A( D/ v% f- n8 C2 r0 lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! z! q n( C$ @$ relse% ?# N: w( C( Y5 }' z, C1 w
cross_marquee.style.left=marqueewidth+83 p! a: f1 D9 k! x- h
! z D& P, _" d" d% H2 `% F# D}
9 N1 j. Y+ ]2 g1 V" w E, kelse if (document.layers){- r* H' d2 e( x" V4 i9 k4 c$ G; b1 S
if (ns_marquee.left>(actualwidth*(-1)+8))7 M. Z) e- ?/ m1 V/ p7 A
ns_marquee.left-=copyspeed2 Q! K0 K' \' J3 W o
else
& Q h" D% _! |: L4 Hns_marquee.left=marqueewidth+8
1 g7 v/ m3 q% {$ j}
0 ]5 C* O" A! e0 U}0 [5 T% I. X1 H
8 R; h9 B( g* q3 @9 A' [$ l- z/ e
if (iedom||document.layers){8 I. d; e" ^3 _0 P/ i* d: A; L$ A" c
with (document){
% R E/ ]# [* i8 Y( O+ udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 }" e" q. u( d8 W+ U
if (iedom){3 B5 S7 Q' N" g$ ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( a6 X$ h: j9 e9 E. }# o# o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% O( b+ N8 v; O9 t6 ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 q" z* d! `2 G; b& k5 D
write('</div>')
' L" s. s1 e1 z+ I5 M}
, ~, T/ |! ^3 `else if (document.layers){
) }- G# D% v: j5 rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) x- _1 A+ z; Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 A8 i3 r/ S, | Z+ _
write('</ilayer>')
$ R* r* M4 \9 n7 N% Y6 B}
* V |4 q: u( g. @' g/ }5 _3 Ndocument.write('</td></table>')
. f1 `0 _' Q6 h! L e! q8 w}1 k7 @8 ]2 \/ h( N4 i. ?9 Z
}% p) \3 |0 ~! m' @- ~; `
</script> |
|