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

|
网页之跑马灯文字特效
//修改宽度
4 S+ g6 }7 z' A' F. X, z- wvar marqueewidth=300
3 e6 @2 f# K! X3 Y" r( L; k1 d/ ]9 A//高度
/ i+ h8 |3 r9 Ovar marqueeheight=25
A, _+ q5 t! y: z" z9 X% q//速度(1-10)( ~$ e( y9 r) [# r2 M
var marqueespeed=39 a$ h# _5 o3 I4 a
//背景颜色: o d* b( q# _/ K6 M$ r; b5 Y
var marqueebgcolor="#FFFFFF"
6 j( G' d0 d" ~- n% y; T//是否能暂停 (0=no. 1=yes)?
9 d: A2 Z F* D( j# Q3 Zvar pauseit=1* D/ \8 w! K; B& \
2 B7 j2 z9 z; h! W//修改显示内容, a7 r9 Y3 @8 N! l0 o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ i6 t6 j. U, q: I" L
4 X7 x+ c1 n ?8 k' X% \# n. |* Q9 Y* @) z9 [1 |
////下面不需改变////////////
9 K' \* P, l$ W4 n3 v1 q
# Z7 v: Y8 R4 c/ b6 L) r$ Hvar copyspeed=marqueespeed( ?( h) ?# C* r9 z9 Z
var pausespeed=(pauseit==0)? copyspeed: 0
8 m! Z, L7 ^! ]8 t1 pvar iedom=document.all||document.getElementById5 o# ~+ K8 \" q" H7 p( @) n! h
if (iedom)
4 ?/ g* b u2 d0 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( q& A8 J& P4 {# q o( _! t& _) Gvar actualwidth=''8 u1 ^" j! T3 T8 k" G6 Q" ^
var cross_marquee, ns_marquee5 G+ Q7 `, |; x
, v1 R: u) o6 r
function populate(){5 t# ]+ i1 U8 t1 t3 F3 I
if (iedom){
; E6 y$ s( A$ J: {+ Q, W% Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% V( I# e! o/ b$ Ocross_marquee.style.left=marqueewidth+8
# W( w3 j4 m5 d/ _cross_marquee.innerHTML=marqueecontent
/ i: k8 V" ~' u* b4 \- T' l. dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 v* o$ }3 J0 Y% m; W. c: U}5 q3 `8 D5 X# C+ O, g) i
else if (document.layers){7 [* T- D+ ^' D9 Y+ u7 h" ^
ns_marquee=document.ns_marquee.document.ns_marquee2% j: l+ w' k l! r4 h3 u# r
ns_marquee.left=marqueewidth+86 ~" m( }4 ?- c a# n: L
ns_marquee.document.write(marqueecontent)
4 f' Y$ q2 [! q/ b* \0 X$ G1 yns_marquee.document.close()% N) J5 _3 H" a8 j O4 s5 V/ d5 V! H
actualwidth=ns_marquee.document.width6 r) Y" ]* k. D5 }# [. o9 b5 |6 E
}
3 z) n+ P9 @9 ]( L8 j7 K% Llefttime=setInterval("scrollmarquee()",20)9 a! p6 f, i0 {
}
' u- x, Q/ r1 |$ e' o: wwindow.onload=populate: P" Z- T z5 h2 p! Y
/ m' A2 F& [$ ~% }8 Qfunction scrollmarquee(){. H$ a8 n& v) |- y, s3 X
if (iedom){5 I2 s, J1 Q3 Y; g. D, i% O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 R: F% Z) Q8 G {3 D |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 u5 \ y) q# G' g+ F& @else
* ?; w' j# h" s; {2 F% ccross_marquee.style.left=marqueewidth+8
; A/ g$ ?% X8 K/ V2 K' Y! ^% Q) f" j$ y: ~+ Q2 c3 Q
}
. y9 n( r- L" V4 l8 M0 v5 `else if (document.layers){# i$ V8 \8 j) x
if (ns_marquee.left>(actualwidth*(-1)+8)) U, ~ J/ j2 i# D, |' P
ns_marquee.left-=copyspeed5 I( b' X. p* c2 V$ t& C' \
else
* ~ _: y7 T, H' Vns_marquee.left=marqueewidth+8
- b5 F7 R d! P1 H6 K& `( B0 U1 o}" L4 i+ t B& y8 d; G+ s1 ~
}3 x5 w0 _% @8 N$ g6 b
! K( N6 p# ]6 Z3 F. X* B
if (iedom||document.layers){, [! a0 X% X4 y6 z1 Z
with (document){/ i" R' I3 r$ O0 L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ a6 x; W8 b' ?9 R8 a% b- ^8 |- N0 Hif (iedom){2 @ I) v* }6 I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 G8 u. h5 }% l- lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# x, f e7 Y' F' _* ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 u* }- F6 t% l8 ~! T
write('</div>')
* H$ g* Q8 T1 r}
( ?/ O' W3 ]" S& k( |7 relse if (document.layers){
" d8 Q( s. M' [9 u. Q! |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 o( a& {3 E" T8 f8 W xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" W+ j" A3 I$ u4 B; S
write('</ilayer>')/ r3 \6 ]" z4 S q
}5 R2 O4 v% I: M9 e' s8 \. \3 d" s
document.write('</td></table>'), @& ^5 r% W( G8 w: F
}
6 L7 n3 e! T& D) R3 I& p# |9 }" k+ b4 b}
( c# w/ M( @! C I0 p3 o8 X</script> |
|