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

|
网页之跑马灯文字特效
//修改宽度
8 o, } C0 ~6 J9 k4 |9 f) e$ g" [7 mvar marqueewidth=300" z! s+ q' `' Y: {2 n3 c3 K
//高度
2 p1 F; U- |4 D* W: yvar marqueeheight=25+ b3 R9 O! u" h$ f* ?# L% P
//速度(1-10)- E1 Q. S7 U2 S% V, R
var marqueespeed=3 `: V. U3 y) l* g
//背景颜色
* i; [ B/ ^" a9 N% T3 gvar marqueebgcolor="#FFFFFF"; I6 i7 v7 e7 z+ j. z8 `
//是否能暂停 (0=no. 1=yes)?
, a- \5 A! b6 N& b' Dvar pauseit=1; A+ W' U; Z3 O+ {6 M* ~5 D, A$ w
3 M1 h$ G; u6 z7 O
//修改显示内容
0 `7 b; {6 [- H( D8 o# b: lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 O# D2 O2 i8 G0 `( p7 u) _) s$ K
3 W: {" n3 \6 \2 K6 O+ M: f7 u
) p+ K/ [1 N7 d, X% h
////下面不需改变////////////5 k, z* g! m/ f5 F/ I n
3 ]0 Z @' E5 O( T9 B) \
var copyspeed=marqueespeed
$ v; F1 s/ L( D" svar pausespeed=(pauseit==0)? copyspeed: 0
& L# M- ~7 m9 e+ cvar iedom=document.all||document.getElementById
# E, s0 r3 \6 \1 Cif (iedom)" U8 Z4 @: i6 |* O4 h! X) @) _ m# s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 W/ S2 \9 i, q9 {& x* W
var actualwidth=''* P3 J1 i: ?4 A" U
var cross_marquee, ns_marquee
& {9 q1 D3 ?) Q9 H1 W' S2 _
b6 @2 n3 C# ?9 I6 k3 r5 rfunction populate(){
0 ? p( S' I4 r. rif (iedom){( K$ b) [1 l0 d; f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" }' A, D5 B3 P! b/ r& U6 h1 Jcross_marquee.style.left=marqueewidth+8: p; r! D, I/ H' A
cross_marquee.innerHTML=marqueecontent
- L+ s+ t& z% }, T7 f" eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. J; G }8 i( X+ v3 A}
! b9 G# p, H1 T4 u) helse if (document.layers){ i1 l1 g% I$ ?( s* }' y
ns_marquee=document.ns_marquee.document.ns_marquee2
& h# U% Z7 i; a p( X" \& _. b- I1 }% hns_marquee.left=marqueewidth+87 _! S& a. w, `. @1 d
ns_marquee.document.write(marqueecontent)
7 M1 N! h! r2 K7 ?( Kns_marquee.document.close()
6 d& m r9 D- I$ n2 C+ _actualwidth=ns_marquee.document.width
3 }; _7 I5 G# p$ k}2 o0 V* `: a- ]" d* ^, l. k2 S
lefttime=setInterval("scrollmarquee()",20)
6 L) f& Z& y& x}6 T* }+ Q9 u' p3 Z
window.onload=populate
9 e/ S/ Q- G6 k; a! Z2 {0 n% Q3 C0 t0 E( Q2 h5 m& a$ b
function scrollmarquee(){
: S' B3 e _; G, A1 Qif (iedom){6 y- o6 |+ C4 |/ H4 K$ c' E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! t: n. X! c! p# R( J c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 | b. @' a8 X$ Q8 C; r: @else6 U$ z" M% k ?7 h
cross_marquee.style.left=marqueewidth+8 q! q$ w7 p. I0 J* p
( K/ i% e' N/ z& J: U0 j}
+ ^2 e X7 u% e8 ] w Relse if (document.layers){
2 k6 ^7 W8 R" f; |0 f" ~if (ns_marquee.left>(actualwidth*(-1)+8))
3 J* a/ V) L* {! mns_marquee.left-=copyspeed
* d: Y- s% Q# a" b/ ]. O$ d/ helse+ z$ s3 s' B9 S4 ~; Y
ns_marquee.left=marqueewidth+8
4 Y9 F0 `6 b7 X}
" m0 H" Z' ~+ K7 d+ [' l}9 Y/ Q0 q/ ~6 ?7 X' J/ q% F
' i* h# M7 E5 A) m9 A7 E' a$ J( }
if (iedom||document.layers){6 m+ {( _& X5 B n% I5 A) D
with (document){
/ {3 r* i6 C9 ^: l$ x- bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- J) i1 H9 d4 @) i% y* u6 _1 _if (iedom){: k$ m' r1 {- ?: R7 Z6 {: d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) t* G7 w; t6 F2 Z7 Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 h- ^" V6 Z9 G4 } M& _ u0 Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- w/ f4 d; Y$ Jwrite('</div>'). W1 Z. B" b9 b) Y0 C
}* M3 k+ _5 {* D7 O
else if (document.layers){# F# E* u9 x7 C" z3 x5 v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 v! u! D% S/ ]6 z4 S2 t! C: |! L" U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 T/ \; G/ k" t) Ewrite('</ilayer>'); P* W X; A9 y5 y* N: v
}
5 o: \# W5 M6 B& [" idocument.write('</td></table>')
6 _$ @: J- }$ y' _% T2 M5 z}9 h2 P% Z+ S" l1 A# o$ Y$ }
}
( |0 C5 _: l8 l K8 Z8 Z2 c</script> |
|