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

|
网页之跑马灯文字特效
//修改宽度" F6 z6 E3 y# @+ _/ i$ n& P
var marqueewidth=3005 R- p, D4 I' ~& O% S
//高度
e% L0 }. G8 ]9 a& z; [) qvar marqueeheight=25
: X0 I. M; r7 t0 Q) i& _0 X. u9 \! C//速度(1-10)
& |1 j! C. s1 k! Z5 ]9 I4 Y$ [6 hvar marqueespeed=3
& h; V- }. [' S# I( ~- t2 Q( X3 E//背景颜色
& ]0 R& x& F, u- k8 e# Cvar marqueebgcolor="#FFFFFF"
* W+ ]5 M8 m$ m+ j//是否能暂停 (0=no. 1=yes)?( l) X) m, U' x% w& g
var pauseit=1
& e' }6 R: V3 I7 ` u5 W9 q) p& G. A% Q( f4 h( j
//修改显示内容
) z& I; j1 [ wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 M+ {6 x# k) s
" T! z% j; B6 j/ i' T
8 P2 L$ a& N1 G2 ?4 ~' j& C+ u* [, `////下面不需改变//////////// I' w! y/ Z0 L, E7 {+ {; g9 M( [
, _8 I6 h' g* T5 i" L+ M
var copyspeed=marqueespeed' ]2 Z# n3 n# b1 H& v8 n# D! o3 a
var pausespeed=(pauseit==0)? copyspeed: 0
& h0 P( @; L: d2 V: K7 Cvar iedom=document.all||document.getElementById
- O: [0 Y4 k/ i2 s2 Iif (iedom)
* o4 }$ @. }) D' V. {, U! v9 Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 p: W) O( Z) c- `
var actualwidth=''
/ }, r$ M: G" V9 Kvar cross_marquee, ns_marquee, v( P- |0 O6 p2 S6 D$ i
4 `- m6 ?: l" C- D
function populate(){
8 `' ]$ \, r5 C+ w8 @0 Dif (iedom){' e. |$ T& c* Z1 i1 J" e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* ?! R+ \$ ]9 A5 t# b& B; C
cross_marquee.style.left=marqueewidth+88 u- ?* j) o1 u: f- v: l8 J
cross_marquee.innerHTML=marqueecontent
# w4 s! Y0 V- |0 ]5 `1 x! ^ R8 Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% \0 Q3 w2 B) K' W) ?
}
+ R1 l2 O g/ p1 w# N- k7 uelse if (document.layers){5 ^6 A; B: L3 d! m
ns_marquee=document.ns_marquee.document.ns_marquee23 I4 D' L8 p( U& q3 s5 A, v
ns_marquee.left=marqueewidth+8
, w( U- P. t. G3 N# Bns_marquee.document.write(marqueecontent)# \' x( ^, A t. r2 U
ns_marquee.document.close()- [' F" `, s6 N$ ?
actualwidth=ns_marquee.document.width! n) c& [4 T8 R! v
}
$ H- D. `# f- V4 Glefttime=setInterval("scrollmarquee()",20)' }% s9 Z2 k1 _
}
3 e* y1 _2 d0 _2 j1 Nwindow.onload=populate! n, ~8 |* I$ y2 A% e
1 i$ Y0 s) Y2 n- T5 x6 G+ L; Q
function scrollmarquee(){5 v7 n, d. u j+ k$ a' u
if (iedom){/ D0 G! M' A& ]2 U6 c: b! N/ T
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 J2 o3 u* W3 \) I. R' B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* a. {+ X1 ^1 ~: r6 f5 u2 belse1 S5 l" i1 K9 M# c. o- k6 n
cross_marquee.style.left=marqueewidth+8
- j& a4 I$ f- u) { @2 N/ K/ a4 h [! u1 Q! A/ {( t" }
}5 b+ e! Y( U* a. x& F9 F
else if (document.layers){6 E7 _* f% C- o& S) z; T9 r# W
if (ns_marquee.left>(actualwidth*(-1)+8))3 p7 t8 |+ S \! Q3 J+ y
ns_marquee.left-=copyspeed
' [# x$ S- i' Y$ L$ y- {' \else
3 v/ P; S$ A: j+ c% t/ bns_marquee.left=marqueewidth+8
) A% @% F+ X/ j2 P+ }}
& _: p! H) y& }- }$ T}
9 y4 L- y: Z! f h$ o# @5 t+ C# p1 \* U
if (iedom||document.layers){
& t# ]* o! U2 fwith (document){: B `) Q- d! Z% k8 \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' ~6 J1 ^, {; c5 I8 X; k! ^
if (iedom){
9 G- ?: [" f& ^7 }4 nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 e; A3 D2 Q6 r9 N9 l, P, ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- I4 Q1 e3 s' r" cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), T- H# ~2 ?# }' @
write('</div>')9 M# V4 V0 O( S8 i- p+ n# T
}
) l" x: W/ J6 P2 t* [+ ~else if (document.layers){6 P8 y' h( v5 `1 A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ w r A$ \8 M2 U4 Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ P S$ h m2 p8 rwrite('</ilayer>')" N |: F P8 d6 a
}# f8 C5 r1 }6 J7 ?$ ?6 \3 g9 }8 l2 D
document.write('</td></table>')2 U' w& `2 y, j
}
( W' T$ L) S9 R7 N0 b9 o" c}; N/ F% Y% \# P$ O
</script> |
|