返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ f) s8 k" e4 I8 R3 Yvar marqueewidth=300! _. p* T9 N4 Y" l" w+ u" s
//高度+ R7 W2 u3 L' K3 Y+ h, x
var marqueeheight=25$ x# l& x1 I" J. ]* G. p+ z
//速度(1-10)
- F/ E" K8 d6 t1 Yvar marqueespeed=3; y( o7 [% L4 p8 G" k
//背景颜色
" s' J- e% {6 F9 g) P2 Ovar marqueebgcolor="#FFFFFF"/ r2 F/ m. u# p( b2 i7 ]4 J
//是否能暂停 (0=no. 1=yes)?
: k6 G) [, H3 X3 K& B2 ~3 x* W- Mvar pauseit=1" E; {  l3 o# p& b6 @+ u7 W
) Q1 M  ^& i- U' Q6 e) P
//修改显示内容
! ?* t4 ?! s1 E0 n( n- Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 o$ J' S" Y  L* Q* Q' O7 T2 I
0 R- D  J- f7 Y) y1 i

- B0 F/ M+ a" q4 k3 N1 ~////下面不需改变////////////5 D8 y* r0 {  m: |% k" u6 [

' R4 n5 M* V2 N* X8 G. z4 Fvar copyspeed=marqueespeed
3 x" O8 ~, |* a  y0 ^var pausespeed=(pauseit==0)? copyspeed: 0
) F; F1 T  i/ M" Ovar iedom=document.all||document.getElementById, F& g) [( A, x6 K4 f1 z
if (iedom)( E! A1 T: j7 _; ?9 f# b3 o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- o6 O% N4 x6 [+ a
var actualwidth=''. ]' d9 m: v& w& |# w5 \3 l
var cross_marquee, ns_marquee
" X6 X6 J! U  l1 p$ x3 _- d: q9 ]7 L
function populate(){: K* W2 k5 s' n; w
if (iedom){
; ?" v: k/ u& x0 @+ @1 Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" r) o3 w7 [2 Q) Y9 N9 \0 Rcross_marquee.style.left=marqueewidth+8
. U) H; k/ Z% d8 W7 e" j; ?3 n: Mcross_marquee.innerHTML=marqueecontent
, ~6 ?2 a. z9 n- b% M8 x5 D; zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) ?  o5 T1 C% a6 p3 y3 Y7 q
}) J) K! R% K5 |% R
else if (document.layers){
, ^$ W# S( y" R7 k( T" kns_marquee=document.ns_marquee.document.ns_marquee2: F) l8 k5 u8 m" i
ns_marquee.left=marqueewidth+8
( z% {+ w2 }  i" X  f1 jns_marquee.document.write(marqueecontent)
6 G* w; B; k; jns_marquee.document.close()1 a" f5 j' v) q2 @% s- I9 e& g
actualwidth=ns_marquee.document.width
5 [4 h% c" A: r}
2 ~! x6 M$ O6 V+ \% ]$ v- Zlefttime=setInterval("scrollmarquee()",20)8 ]; M& ]# N6 f: c: `+ U& D
}
$ \% `+ l; N, L3 ~- y1 lwindow.onload=populate
& e& R# E' i+ k/ C
' f% v  R! q: r! W& @- I  `function scrollmarquee(){
1 }8 B, R; I4 U4 `if (iedom){/ ^% c* Q: A, V- m* m
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, H* U. M* O( p- ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* ]8 h3 x# r% Z
else; w& ?5 h; i) h
cross_marquee.style.left=marqueewidth+8
& w" x# ]& X7 Q5 ]+ f! I% n( C) z7 L$ U/ {9 g% o
}- W" _. Q; O# U. h4 c2 e
else if (document.layers){
: t, z0 I' t5 ~if (ns_marquee.left>(actualwidth*(-1)+8))2 a; ?8 |  C3 \  X
ns_marquee.left-=copyspeed
3 N9 e/ |" m- E* U1 J) |/ Q' ?else8 a2 I  e0 m/ @: `) y
ns_marquee.left=marqueewidth+8
* x. o' q/ h! l- L4 u}
( P: s: i/ E" a8 X+ n! Y, H5 T}
. J. I, ~: u9 ]! F
' I+ r9 i  [$ x6 i& Dif (iedom||document.layers){
) T, x" T& v3 X4 t7 T$ R0 ~with (document){5 d  n) Y6 l3 J+ w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" S( @3 U) l3 X
if (iedom){( S# C* C( c% {) @  n( _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 R, j7 [8 r& k2 g; S' w; Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! K: h' Z& z4 W  B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: x4 ^& u& x3 z  X4 U9 `write('</div>')+ H4 ?8 m+ A9 }1 S) S
}; E; d, _4 }/ L7 \+ U/ G
else if (document.layers){( P6 {* j: p' g3 D" k6 \5 F- m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 C6 Q: W( ?! a6 awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, B4 x5 c1 W. n$ {/ Iwrite('</ilayer>')7 I& j1 Q) r9 k" r! H" }- Y5 U
}
. @1 _1 i0 H( M5 Ydocument.write('</td></table>')
+ r# ~  x, c6 z/ t; y: D) b}. l3 A: n2 a$ P
}
( X% ~/ X% K+ J3 H) j. f5 K, m</script>

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