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

|
网页之跑马灯文字特效
//修改宽度- M t! h* x6 E6 f
var marqueewidth=300
( z& ^* H; Q, y |//高度
2 F# h/ g, M9 |var marqueeheight=259 c4 ]+ e, s0 k, \# D' F" @; d
//速度(1-10)
# E6 D7 _5 q1 X. P8 a, ^- b- Avar marqueespeed=3
1 X! y: n0 X& f; X6 X. o* F4 U5 N//背景颜色* O4 X, X1 ?9 W, S% |
var marqueebgcolor="#FFFFFF"9 S1 x# s Z; x8 }
//是否能暂停 (0=no. 1=yes)?
, j; V9 D. f5 H9 N, l! j5 |8 h+ `. Svar pauseit=1
& ^7 d( z( d; r6 `- n' K9 o: o4 m7 a4 }% R5 E2 ?
//修改显示内容
$ G5 @, E; ]) Q8 h& b; H* Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# \" j7 D% ^3 Y5 i) E- |" T; h I( z! ?
4 x5 O# ^3 Y/ g6 R {////下面不需改变////////////
; ?) A5 d, K) n5 A t" a1 l9 Y' ?6 ^, W0 R4 s8 I
var copyspeed=marqueespeed3 Y7 c. L2 B2 K; K. r) p& B& t& R
var pausespeed=(pauseit==0)? copyspeed: 0
% C. N ~9 `, ^6 q+ \var iedom=document.all||document.getElementById
3 _: |8 h. q! R/ G% ~2 u$ o: B( zif (iedom)) `( M2 z, ?* K- W' Y* e& ~: ?2 a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) ]( l& q9 c" H. O }5 A, yvar actualwidth='': w& E2 |0 R$ ]1 K, _0 P
var cross_marquee, ns_marquee6 d% j, g+ f. _) Y
6 }* t/ v$ X8 m( E# X5 @5 u& g
function populate(){
& z$ H$ q9 w. F3 L' Y' A* ? h5 aif (iedom){4 X5 Y; N# Q. p3 J0 J$ ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 q. |, @( @( x$ }' j& Y. Rcross_marquee.style.left=marqueewidth+8. B+ u @0 L6 `% U6 n% |
cross_marquee.innerHTML=marqueecontent8 A- Z# m5 c1 r0 ^9 n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' Q6 Y# h: N2 p, ]8 O$ O$ r}" \. k, x0 ]5 W0 }, _8 P. Y
else if (document.layers){
6 L& n8 a$ U" s4 Z* i- Cns_marquee=document.ns_marquee.document.ns_marquee2
8 r* R( H1 N( ~0 Sns_marquee.left=marqueewidth+83 o. l( l; h* x4 {% [' e
ns_marquee.document.write(marqueecontent)
/ J' H5 H8 N1 I! A3 Nns_marquee.document.close()3 L8 }/ ]; C# c4 Q9 o; f; H8 o
actualwidth=ns_marquee.document.width
. c8 ?+ F/ Y/ M# j}
$ H* A' Z. V4 L$ w) llefttime=setInterval("scrollmarquee()",20)
. B" t/ p. C/ r4 _# U( g1 S& m}4 _, [) r+ h' _# `
window.onload=populate
! q4 O3 W1 v7 v- ]! k
! o$ P! i8 q$ v( B lfunction scrollmarquee(){
: y4 m: h5 `& }- |' t' k! pif (iedom){4 l( Z, T3 _3 `8 P6 ?" y& S( i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) o/ N4 R3 e9 s5 h8 I: M/ L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! }' [/ V7 K# W' ^: |else
1 q+ F6 u2 i. N' P& ~cross_marquee.style.left=marqueewidth+8* u$ V- n; z! S3 w& G
$ x0 q$ Q- w$ g2 d2 K) o
}* y+ p$ U" q7 x: O* U
else if (document.layers){/ J! X0 {7 _3 l/ h" f
if (ns_marquee.left>(actualwidth*(-1)+8))
. B- G9 ?3 H2 T3 Q gns_marquee.left-=copyspeed _* e5 }5 q( }# k: b$ t
else
& U- q) q( \# pns_marquee.left=marqueewidth+8
! m1 u" e5 C7 x4 g}
5 M7 Q/ r3 N6 ]$ b1 o# U}
" z' g8 { N) G* l K0 Y; [. l
3 |# I4 Y- q( x4 a" hif (iedom||document.layers){
4 F& } j8 Y0 A3 {with (document){
/ e5 J9 u- h9 i8 M1 H, ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% _, w1 k* ]7 s4 V/ jif (iedom){
" A. \$ V; d bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 j; e0 t+ t: h0 t- e: @( U: M* ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% D, }' W+ P. [& N3 [# L( p% U8 ~2 u* [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 z4 h: m. X" O2 ~$ S( q' ewrite('</div>')# F$ F# O) u! z
}& E; M2 _7 T& B" T
else if (document.layers){
" }6 }3 K9 u# c6 o! Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ K% o9 O( i+ J% `/ C1 Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; _/ W4 m, N0 u/ {write('</ilayer>')8 G9 V) ?3 h7 d0 D. C# m
}/ {) H3 j+ e9 {4 D) z
document.write('</td></table>')# Q: N2 z# \' K& L! \5 j9 E: I
}
. `, M: g; e1 B" h9 u}$ g9 g9 K+ V/ E) B6 N6 [
</script> |
|