返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% t7 N/ B/ Q# @6 D/ I- t; q& Gvar marqueewidth=3008 F- K1 U9 E2 s2 h, A
//高度
; A* k; w) G$ \" {2 mvar marqueeheight=25
. n+ o( B: L, N( p9 ?//速度(1-10)* o. B/ b2 |, Q/ T7 N1 |
var marqueespeed=3
, E' Y% R3 I7 I$ _- W//背景颜色
% w1 d4 j* p& ivar marqueebgcolor="#FFFFFF"
, z4 f& R* L$ G8 n//是否能暂停 (0=no. 1=yes)?
# M& e' j$ b7 {5 l  v' C" _var pauseit=14 {% ]. e" q  R9 f( D( c

  t: N3 L/ G- j" u//修改显示内容) ?7 h# Z/ {+ q/ h- G" l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' |- w7 P7 A9 v
- O# I* N2 I5 W& d* p, [: d/ Z5 a: F, q7 l
////下面不需改变////////////
. h+ _9 I: l# b2 L
8 H4 v2 _! M3 w7 g" ^* f8 Z9 ~var copyspeed=marqueespeed
9 \5 v, p& y3 A% M9 Cvar pausespeed=(pauseit==0)? copyspeed: 0
9 ]4 C/ ?0 P7 Q; v5 T/ jvar iedom=document.all||document.getElementById# j" J# F. w- \6 w
if (iedom)
' f6 a7 k: U/ L- g- |( v7 Z* v! mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 t! w2 }7 ~* B) c1 O0 p, R) _# H+ x
var actualwidth=''$ J' U5 a' T$ l: [
var cross_marquee, ns_marquee0 a0 L8 O4 b1 t9 W( j- ?
7 P+ c6 L% p; J% j5 T, u7 q9 V2 A
function populate(){( l, L  N. f3 x- P
if (iedom){
! x  M% R! [- f1 `  k; T5 A% Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( r1 @9 c6 X6 Ucross_marquee.style.left=marqueewidth+8
( s  P( E5 {8 _0 L( _5 w( @1 h  Xcross_marquee.innerHTML=marqueecontent7 ]4 W( h3 }, t1 X4 v4 }1 g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 B, ^% k* N# ^4 M$ r}1 k$ c7 N6 {. g
else if (document.layers){
- o# c: R+ X! T6 @; m$ l4 k  lns_marquee=document.ns_marquee.document.ns_marquee2  [  ?9 X7 n' M: v
ns_marquee.left=marqueewidth+8
1 _; D* b0 k3 L8 kns_marquee.document.write(marqueecontent)5 a$ W6 R7 U% k) X
ns_marquee.document.close()0 S5 U9 j  j% X# a' g
actualwidth=ns_marquee.document.width
/ y- H. J4 p) G9 k& I1 M# A}
# ^. i6 M1 D! blefttime=setInterval("scrollmarquee()",20)) \" q0 u; T0 k' |- s
}+ E: p5 h) U7 d( q; @  X/ S
window.onload=populate
+ V" w9 U! \+ @2 @& L
+ \- Y0 M' m2 o' e' S* {$ o! t' kfunction scrollmarquee(){
6 x) F1 \3 M2 g( A0 [if (iedom){
9 l. D9 Z4 q' cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, S$ `/ ]3 V# i/ @2 ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ z- a3 V; Y/ ?5 D7 O4 L) q( f
else1 V1 f. }: i, g2 D: V8 D$ @9 y
cross_marquee.style.left=marqueewidth+8
$ c# M% |4 |' u/ b& f6 @
' v5 P$ {4 t2 j7 V; q}
0 P' j$ M  V4 s- celse if (document.layers){, _7 S+ y# H9 x  V) Z
if (ns_marquee.left>(actualwidth*(-1)+8))( z& w: a0 Y# B( s
ns_marquee.left-=copyspeed
7 l; D8 _, a, z( Xelse
! L7 }  y# |( u6 ?4 f" |ns_marquee.left=marqueewidth+8
. j, I- w) H8 X' U' H9 E}
4 E, z# N9 G9 u}. a5 b! x! h, H) z. l( b  D( @
- d' T. ~7 `, o
if (iedom||document.layers){2 W2 p% L2 N: W% i
with (document){. h: X/ S" w# A
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( K7 ~! B9 _9 G8 B; b: y! k% f7 aif (iedom){
9 ^1 [6 x& a3 S0 e6 U+ y: Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' D& ~9 I& t8 r  r. p3 Q# iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 P3 i# W* D1 Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 J, o: G/ E2 I* W! w; L
write('</div>')
! u) e& n1 T: y+ d& c- }}. D+ J1 a+ e/ q5 r, y1 I; e" _
else if (document.layers){
" ?2 T7 W' z9 M: `; w4 Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 W9 c/ ?6 ?" j) {" C5 \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 p1 C1 U. A! O# X
write('</ilayer>')
1 S+ `, @$ j  D  U/ h}
! B; A& X* H; o; e$ k# ndocument.write('</td></table>')" c6 p) Q( C* b
}1 g3 z, ^+ Y  O% d! z9 C
}
! O; \# H2 v' J" O% O9 {</script>

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