返回列表 发帖

网页之跑马灯文字特效

//修改宽度; D+ \$ J* Y3 n
var marqueewidth=300
! X/ R$ |* s& O6 l! H3 ~+ K//高度7 N& B. F! R$ I0 m  e
var marqueeheight=25
4 i% I7 I9 X4 N, F7 x3 u. r5 _//速度(1-10)
' B: L9 W& Z, S  S* a5 vvar marqueespeed=3* {, i- r# O( [9 S; |
//背景颜色+ z0 i4 M8 o7 \; G. t0 j
var marqueebgcolor="#FFFFFF"& Y4 l# z; Z+ R' k  G" n
//是否能暂停 (0=no. 1=yes)?& {0 d/ U/ x! G2 J3 W
var pauseit=1; c2 v" m' F7 x& r' z% d$ ~
8 s6 O4 k. r0 g& T) O* X
//修改显示内容% `7 h& M- ?: o- m0 q, \+ m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% c: w8 A# J7 z( h9 v) O8 `- I6 Y8 I

. ]% v: Z9 ^  ~  t////下面不需改变////////////1 W! l+ r$ [' e) ~0 g& c' x3 d
8 f; T9 g! |2 C& [
var copyspeed=marqueespeed
+ @7 U7 T# [  u# s# }1 ivar pausespeed=(pauseit==0)? copyspeed: 0( \: t0 d- R$ I
var iedom=document.all||document.getElementById' w  E* t1 ]* }6 U+ b; R- h" y& z
if (iedom)5 x5 ^. i4 K$ `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 n: q* b3 W# |( [
var actualwidth=''0 p* j4 Q7 D: H* ^+ {/ U  V6 \
var cross_marquee, ns_marquee/ j* q/ v2 p1 w/ d, P1 m
% }7 Q" ^# ]" ^# ]" Y% F' I3 I. K
function populate(){* w: n5 n# m+ x
if (iedom){
/ u0 _, b, ]7 Z( o' jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ ]) h* v: R( {! y$ Hcross_marquee.style.left=marqueewidth+8
+ K6 Y4 e7 C2 ~# T+ n, R; hcross_marquee.innerHTML=marqueecontent4 O1 {4 o* }3 g. L6 P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) o7 F. S" [) a1 U" i  ~6 E
}) l$ y+ ?) Q3 Z1 ]6 @7 p* Y
else if (document.layers){& |9 U' M4 W/ n2 V' {8 G
ns_marquee=document.ns_marquee.document.ns_marquee2! D3 n. a9 ?+ ^2 T. V7 q2 ]
ns_marquee.left=marqueewidth+88 c, P4 J0 S' o
ns_marquee.document.write(marqueecontent)7 z4 h5 g, j, \" v) R# c& \( _
ns_marquee.document.close()0 C+ A" A- D* a4 v6 ?5 C
actualwidth=ns_marquee.document.width
6 W8 s3 r0 h( t; M! V) X5 l}, Y% w/ N: m/ S) g6 k) g
lefttime=setInterval("scrollmarquee()",20)
2 Q- w& t; B# j- q- A, {}# W& n. V/ ?3 @, W- c7 N
window.onload=populate
% l& ]. q% q/ |8 n3 t4 L
7 {" b' c5 D" `function scrollmarquee(){% q. z8 |' ?6 |; R# P
if (iedom){
* P0 P- [  F! a! s1 o/ vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ y  z- j" Z/ D0 J* l% w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" e; t/ N% S* n+ y8 nelse( R. D5 |0 B4 T& w
cross_marquee.style.left=marqueewidth+84 S4 E8 }2 @  ~" x3 E
3 e5 e& R* Y4 n* t  L2 ^
}
. Q/ _3 W, [! p. Eelse if (document.layers){" L% d* R/ L6 ]1 `6 q4 p
if (ns_marquee.left>(actualwidth*(-1)+8))
( F  g0 e$ |2 T9 e+ ^ns_marquee.left-=copyspeed, d% g* C6 `+ M5 f
else* [. ^) J& O: ]7 Z8 p
ns_marquee.left=marqueewidth+8
7 m/ I: ~. c$ J# V% }) G}
* k. F: l& ]- Q0 R}
0 S& b2 k: }; U, b, \- _$ E: V0 Q8 U$ u: `0 o% U
if (iedom||document.layers){5 A  V/ J* ]3 C( o. W% @
with (document){' C  L0 N1 Z1 e) c# ^+ I% O8 \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), B! o/ }' c( Q8 D# P7 [/ h
if (iedom){" C; W2 }7 P! H9 p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  K9 h* P5 O. j: ?, bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 ~* E- i3 b# f9 ]5 k: ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# O: l+ ]+ U: }2 n7 t. ?1 R
write('</div>'); ]+ \5 `, ?2 E$ a/ Y
}! s. F. ^5 \: W& e, s
else if (document.layers){
+ X7 s6 \1 G& R; h7 d2 dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) K8 {* ~+ x4 h% E1 n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" |$ k3 r& U( I; H& `5 m, e" m; p
write('</ilayer>')
2 m- N/ I% C- w) T  u" X/ b( z}3 n: ]+ O7 L0 K8 s
document.write('</td></table>')
3 k1 K8 d9 w* b5 q}4 Y. k  ~' u& r
}
  M$ j5 ?# |' W+ Q# R: ]</script>

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