返回列表 发帖

网页之跑马灯文字特效

//修改宽度* F- C" J( l1 G2 Z" Z7 v' E
var marqueewidth=300
! a3 H7 r$ o$ u" r+ V+ ?2 A9 N//高度
8 I. }( G. L9 O% b6 Pvar marqueeheight=25
( v1 R1 x4 L% Y9 y1 A//速度(1-10)1 u) Q( g9 v" `7 m/ i) U; a
var marqueespeed=31 \: i! J1 p/ t# d
//背景颜色) C6 N+ r5 M1 A7 o9 H* [5 V
var marqueebgcolor="#FFFFFF"9 K( M* j/ K# ^& H. j8 k
//是否能暂停 (0=no. 1=yes)?
+ y) C" w/ A) p& I, xvar pauseit=1
) W% r. f, ~* @5 W2 R
# h4 X/ H  Z3 h  Y+ l//修改显示内容. N4 |3 m* e, }& \& Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 M! Q5 Z8 B* i/ q) {3 |1 G- r# D
( E/ q2 c* r9 J! e3 g
" W+ k! k6 e8 T8 o////下面不需改变////////////
# N8 [' o; e- g* V5 R7 U  ^  C+ h# d/ b
var copyspeed=marqueespeed$ g& U& [( f/ H
var pausespeed=(pauseit==0)? copyspeed: 0
! b& t3 k2 |3 d$ P) Xvar iedom=document.all||document.getElementById
% D6 J" d+ G2 G4 Y+ T, Dif (iedom)4 f" K: y% p4 S; b% @1 C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' b' K8 E% K3 a4 q9 Jvar actualwidth=''
4 u# d1 G1 s2 j! a( Uvar cross_marquee, ns_marquee3 e5 [% t! h5 Q; n
# U, _4 j9 q& \4 y( v
function populate(){: b0 o2 F9 m+ H/ a& q; z) ~& F
if (iedom){
" W/ d' Q7 H) N' Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ \' f( F$ Q7 |  p% J& b
cross_marquee.style.left=marqueewidth+8
+ H, l+ }7 o0 }1 ~cross_marquee.innerHTML=marqueecontent
4 X$ s! r5 @& `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 g5 R2 r, O; [9 a2 ^, y
}1 H9 O& q5 o- k! y
else if (document.layers){" t( k- H+ J: f  V  `$ T/ ~
ns_marquee=document.ns_marquee.document.ns_marquee27 B2 {' ~5 X, n
ns_marquee.left=marqueewidth+89 ~) Q7 [0 O9 ~' F
ns_marquee.document.write(marqueecontent)& s* |$ W( ?4 a& l
ns_marquee.document.close()5 u% m0 x" a5 @8 b2 W& D( J
actualwidth=ns_marquee.document.width% r! }: A' C5 ?) x
}! y9 P) ^3 A  V- y& ]- u1 l( h8 f  g
lefttime=setInterval("scrollmarquee()",20)
6 j/ q8 Q( o/ m' H" S) F/ S% X! t}! K& W$ D* W' y9 ^$ F, _* t
window.onload=populate5 S! f+ Q# J7 X, P) i  s. {! q

$ C0 q5 n: U, U5 Y, H  A* Ffunction scrollmarquee(){- ^5 B6 x9 K3 y
if (iedom){" X+ r' U2 Q0 a& B6 `: e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% ^) ]) l* h: E5 Y4 H6 c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# B% [' ]" O( ^0 Z1 belse
3 f3 L7 z* I. F8 h; J, [cross_marquee.style.left=marqueewidth+86 I2 e0 j( q+ a7 U- [6 u7 A
2 w0 W. U  H0 u* [" R
}! x3 Q& G7 E5 y2 W
else if (document.layers){5 k( A" t. x% D, B" K9 A1 q
if (ns_marquee.left>(actualwidth*(-1)+8))6 f( F# N0 p+ h: S: l$ ]
ns_marquee.left-=copyspeed- z: k; {4 l, ]8 C- S
else
2 V% h5 h0 B; a9 q6 s, ens_marquee.left=marqueewidth+8' q% C* N0 n# x+ {( H
}1 P/ Q: m/ e7 e6 `7 Z0 c. d
}' B8 Y+ a/ I" }5 x$ H: d
  R; n) ^; K, A* ~# [- g6 k$ q
if (iedom||document.layers){- d$ L% P5 X* L! b5 W
with (document){
) w- \$ [) _* q, e* Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 r& a2 o' [0 n5 D7 `, r4 @if (iedom){% V% q/ o2 R( `  B3 T$ k+ e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; e7 I1 M& Y- Y) M) ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ x' h- x) g0 h) T6 c& y) X0 ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) f7 v* j3 F% z0 Nwrite('</div>')
1 _" @' U) b  }+ D! n}$ K+ `( l2 t! x# B' I* g
else if (document.layers){
( u: r6 ]: [0 z- o& @4 d3 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). G3 r& ]/ a+ N( A  y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: K+ I1 G( j: `- Ewrite('</ilayer>')
/ S4 E' j' Y5 T! O# r6 ]  [9 `5 L# p}* g: l. G* E+ N1 b
document.write('</td></table>')
  P5 G2 x* @. q# E}
2 i8 v" s! T1 U$ L' m}
) T; n4 m8 T# R. L& o</script>

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