返回列表 发帖

网页之跑马灯文字特效

//修改宽度: p! U6 l/ W0 L
var marqueewidth=300
/ m7 O0 G# W8 Q9 J- e+ u//高度3 W; H8 P2 I7 N2 h* Y7 ~' _- l/ H: {
var marqueeheight=259 C+ }5 w1 ~6 v1 Q# ?
//速度(1-10)
# i) x6 m0 T! R7 t5 l% ?5 dvar marqueespeed=3/ l6 j: k6 `7 {* G1 u4 @, ~8 ?' @" ]* R
//背景颜色/ \- C) c" j0 x, G! d6 t
var marqueebgcolor="#FFFFFF", s3 @1 \: K. U0 ]; `
//是否能暂停 (0=no. 1=yes)?
* ^& [9 f( J; |/ }, n* ^* Zvar pauseit=1
6 d  }# H6 c% o& E4 U1 K
5 s5 P  r5 \; l' ^4 n//修改显示内容. ?3 z* [* w% _; \/ x2 q. W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 L' O9 o  X" N; M6 p4 p
+ r5 n7 o+ z7 _$ A( b
. I8 O) F* ~  ~3 b2 Q" g( j////下面不需改变////////////1 I" ~. A- h! v! Z! a2 Y0 j2 n

7 s9 l' w9 f$ H9 Tvar copyspeed=marqueespeed
$ I* }( r1 E* d* Hvar pausespeed=(pauseit==0)? copyspeed: 0+ e- @7 u! C, E/ i7 u3 A8 {
var iedom=document.all||document.getElementById# ?9 R" l1 N! a5 M" J7 }% c, b: L
if (iedom)
( F. s1 u+ q! u: Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( e% R8 N  g% o7 n' \
var actualwidth=''
% o1 d% t  b1 n: a0 o5 avar cross_marquee, ns_marquee$ L0 b  \* D5 `, N. i1 I

- c0 \0 Y; w. B* z. o( jfunction populate(){1 j5 |5 r& {% f/ G
if (iedom){
. T) c4 x5 r) H# kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 h6 A) l. d9 |, s! I$ c
cross_marquee.style.left=marqueewidth+8, V, s9 e8 ]1 `$ G" ^/ V
cross_marquee.innerHTML=marqueecontent' a4 S/ ^+ U1 h4 |7 M" H1 k' F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 @9 K5 \/ ]/ R5 y. `}+ Z  Y0 j: g: p4 G
else if (document.layers){
8 H, ^; N/ t& P: `, rns_marquee=document.ns_marquee.document.ns_marquee2+ e7 K) v  e& f& ?
ns_marquee.left=marqueewidth+8
/ a' G7 w/ J) N0 o/ _! zns_marquee.document.write(marqueecontent)
* v6 ]1 E. o& i9 P! v; Dns_marquee.document.close(), q" z0 N. m* L4 ~/ }7 x, j$ V
actualwidth=ns_marquee.document.width
3 F; C! d' f: h0 v4 f% l, R6 p9 M}0 ~- L$ [6 ]- t4 k7 d% s
lefttime=setInterval("scrollmarquee()",20)0 h4 C) m* J7 \6 P# }, }
}
6 Y" W- k% A/ I/ @; R  _* dwindow.onload=populate
, [( G2 T; \, L0 `+ S" ?& D3 T6 t  F' q5 W* Q: l* {4 `. ]
function scrollmarquee(){
4 t( o+ Q: n* S6 M! ^" q# tif (iedom){5 s5 u& \- V4 o( W8 t5 a8 p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 w# T& f" b) y+ u) Q, A% qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  p6 n4 h7 J3 R
else
" g; b1 b! `# h" G/ Qcross_marquee.style.left=marqueewidth+8% H; i& Y) c; f. Y% q) Z2 c
& W) y0 c) f% a% j9 a
}) s7 R# N' L: D. d3 h
else if (document.layers){
, M+ [7 \! ~! M. ?. |6 [if (ns_marquee.left>(actualwidth*(-1)+8))
* g  S7 P7 y' `1 S, |) Vns_marquee.left-=copyspeed
$ d. ~/ u% x- j- j1 [else
. q) P5 Y+ p5 G+ A9 |/ Lns_marquee.left=marqueewidth+8
2 y4 a5 {* \0 a5 h$ r; u* g}
' F  j7 i! E) v, {& ]: K}
( ~3 n( E/ f: T& g' `- L* |; p& }2 _$ q' K4 T1 S; [. q2 a
if (iedom||document.layers){
! p  A5 n" P2 n" V% G: [with (document){
. `% a% H. k- q4 `# J3 B* L( _# gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 o# E. c9 v+ V/ k! j7 y. I% V
if (iedom){: p/ K5 C8 T/ i9 Y" Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# y& P4 @8 N' `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) \9 B* V* f& Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- W, A1 I4 w# D
write('</div>')# f' {) P! x+ ^# w
}
1 T& E% O8 e' N8 _; D+ `else if (document.layers){3 H* a  N0 c6 y+ y2 [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 E( ~( c+ c- F  e  Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' i; ^: a/ I+ o, ^, z- Swrite('</ilayer>')
4 [( u: G/ I. b. a0 D& Y1 |}! G7 u5 [% n: k% l" q1 d) l
document.write('</td></table>')$ ~; B4 R: S2 ]' q3 `) W1 j
}7 S3 L  T" z6 Y- h+ [
}
5 F& |3 C* _! g9 u+ K4 ]% a</script>

返回列表
【捌玖网络】已经运行: