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

|
网页之跑马灯文字特效
//修改宽度- l8 z1 ~8 o0 T" s& T0 g6 Y
var marqueewidth=300" g% f# [' V4 f2 o) W" O& s, q: X
//高度
/ G: B6 F @ g* W0 x+ @var marqueeheight=25
' B3 @( Z+ Z/ A//速度(1-10)
! G! S0 _" n& r; I, ^var marqueespeed=31 A& \3 }& e6 r6 H+ \$ |% i# w
//背景颜色
t1 u# I4 F: s7 P1 g# `' W; evar marqueebgcolor="#FFFFFF"
) A8 J9 p( g8 g! ?1 n) y# h//是否能暂停 (0=no. 1=yes)? n) k# Y4 t, G
var pauseit=1
2 u+ Q: V* B# B3 S& U
( M5 b. b9 X7 Y7 _) c I//修改显示内容: L1 R& X4 Q6 U! T& V/ b5 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 o4 ~( }, E! \! ~7 u2 }
& l+ K+ Z) A. h9 q5 ~
$ c: F. F; F `7 p+ U* ] B////下面不需改变////////////
6 f% }2 _. {) e$ x& G$ [' D& i6 z o
var copyspeed=marqueespeed
+ f; h5 a; J+ O( g- h: }8 N: gvar pausespeed=(pauseit==0)? copyspeed: 0$ L" l' L! a- ?/ M. s) ] [
var iedom=document.all||document.getElementById3 v; O' y0 e+ }0 s
if (iedom)
5 q$ O1 ?5 l! Q: ]8 |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) p$ A. ~, _% i
var actualwidth=''
/ C2 \5 v G. N; lvar cross_marquee, ns_marquee0 V$ D. I& j4 `4 H
8 a% C4 ]0 p$ J/ K5 e& [- \function populate(){: `1 R+ f9 w& [' f9 G9 a" Q+ \+ p
if (iedom){
/ B# _5 k9 p4 L3 U) Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! Y$ h* w( s" R8 _3 V. Xcross_marquee.style.left=marqueewidth+8" Y; p8 k" [4 W+ a
cross_marquee.innerHTML=marqueecontent
, w2 ?$ D7 w0 n- O) ^# B, I5 _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ |- k0 L1 u9 I/ U, p+ r* ^! {}4 n; w8 e( I: a; m( s9 L* p$ U3 K
else if (document.layers){
" S; Q* |" X' [ns_marquee=document.ns_marquee.document.ns_marquee2
( I6 L( c3 E, C) Q- i a, j6 Nns_marquee.left=marqueewidth+8
4 H9 l6 C, D6 o3 j* H" S+ Xns_marquee.document.write(marqueecontent) r7 U( I! q4 T, P
ns_marquee.document.close()+ V' |4 C, Z3 l
actualwidth=ns_marquee.document.width* n8 f3 h* n) N) K5 b X
}& A9 {3 q1 o" k# f
lefttime=setInterval("scrollmarquee()",20)+ Y, ?: o( {& |, w* g' a* s
}
$ }2 v# \% H8 X" n3 gwindow.onload=populate% K5 e! D+ |- a; y t7 P
& X7 Y# x( a4 B% x/ y" zfunction scrollmarquee(){
2 g0 c0 N7 w6 f L, x6 }2 \1 o4 Sif (iedom){
A: C8 P( D, x9 C, U9 hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' j' ]; g0 ^3 n8 ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: k, ]7 i* T: N7 w$ Selse
$ a \& |0 J- D3 q: c# v4 w& O' Z! c9 qcross_marquee.style.left=marqueewidth+8* Z6 o8 E: v' m4 x9 q
7 `6 X9 x- r. d+ l
}6 a$ C+ d$ t, D; W- T9 x- P; T0 {
else if (document.layers){
# t" q* k" ^) S4 \1 \ D$ [# qif (ns_marquee.left>(actualwidth*(-1)+8))1 `' H: \$ O* m# Q- T% d V# D" I z5 Q! D
ns_marquee.left-=copyspeed- N/ c4 j; Q3 k4 O% J9 r2 j
else
5 _8 v1 g: P2 A3 |! {3 }- Xns_marquee.left=marqueewidth+8
/ G1 U) a; I6 x+ P}4 G, j$ L0 C. ~( M) Y" J, J7 [
}& f( a6 i. W2 c) n/ f! M6 F& t/ ?
# o$ ~1 u4 X d. {1 i6 W1 ^if (iedom||document.layers){
# v$ Y* n) F0 R9 d& Lwith (document){# w9 i4 F. F3 s" Z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), K' e& ~" d- |3 X1 P
if (iedom){
6 q, ~9 H* }2 G* X6 ^9 ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): W& z; F. J/ U1 l2 O$ r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 ^; S* S$ T# @* x( A4 l% F5 o9 v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ P7 @; m7 o6 F) r- G2 x- l
write('</div>')+ f- e7 J& }( ?* L
}
; ?7 ~% O6 e) nelse if (document.layers){' h- c& U0 E) H1 ]8 h- }1 _5 o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). V) t3 r. y; `# B! f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- i- O. W9 a9 cwrite('</ilayer>') ], q8 a Y9 D7 n! X+ y. v" B
}0 \: n! F/ G# M0 T. Q+ ^& v4 p9 c
document.write('</td></table>')' T) M$ C$ @* n1 K& s
}6 v& n9 S- e; T8 j4 }; w
}& O8 C( N! Z0 ]
</script> |
|