返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ ~& K" Q1 V+ r8 p, a
var marqueewidth=300  p/ N7 o' y# G
//高度- u6 c' H9 ]8 P& W3 W" n9 i) W
var marqueeheight=25
: p, ?1 N% L8 M( L% A8 V: s. Y- B//速度(1-10), u: W, Y9 i: K& q
var marqueespeed=3
+ s5 l" [' R" h5 O1 G. o! @//背景颜色
& y* S, M* H" j; T5 ivar marqueebgcolor="#FFFFFF"% u4 K8 T6 n3 }
//是否能暂停 (0=no. 1=yes)?3 u* L# M& k0 _. B
var pauseit=1  Q% z* |; m5 ]! w9 {) b, \
0 U9 h8 m+ i& `0 F
//修改显示内容
8 o8 b$ F6 a) V/ B/ G6 W6 }, Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, R$ m# y6 y% t) s+ T1 K( N
$ Z, w* @, e8 u% X
3 g0 M) F$ D, f" p3 O) [7 q7 h3 P+ G////下面不需改变////////////
! m$ S: A5 A' t/ q. @3 _/ }" w) Q+ P& Z
var copyspeed=marqueespeed7 M  [9 Z+ ?  y( W
var pausespeed=(pauseit==0)? copyspeed: 0
' o5 L( t. a$ @; Mvar iedom=document.all||document.getElementById
. X# i  x; X: J$ Z1 i7 ^$ g- Vif (iedom)
. i5 _3 B6 `( w0 Q7 w, idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. w& _8 l5 D( s9 J6 L7 e. Lvar actualwidth=''
2 x7 z; H- c; S8 ?% v/ r- f# @$ lvar cross_marquee, ns_marquee6 v, W4 m$ C# m0 p& b
1 P8 D; g7 ?, J$ l- s( b
function populate(){
; a# ~' e2 s) ^* _6 Kif (iedom){' ^* U! t! o5 _9 U3 Y. F6 x6 L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 O6 n& E+ O; lcross_marquee.style.left=marqueewidth+8. Z" f! Z5 e  Q8 _  @
cross_marquee.innerHTML=marqueecontent( f% m4 J# Y, p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" D, O6 R5 J7 u( J
}) i. m2 R5 s8 L' K' D
else if (document.layers){) F. V  [& x  b& ]' ?# v' G
ns_marquee=document.ns_marquee.document.ns_marquee2
1 J9 R+ R. r! n  o2 |ns_marquee.left=marqueewidth+8
0 i0 S3 n1 B) L6 p$ a4 {( `ns_marquee.document.write(marqueecontent)- B1 X: N/ ?. a- m
ns_marquee.document.close()
% z/ P8 B" x! x) D1 B0 N& Pactualwidth=ns_marquee.document.width
8 y  t5 |/ [6 t1 s- I$ G}! u" `4 F/ p) [' A+ z2 {3 k
lefttime=setInterval("scrollmarquee()",20)7 Y/ s2 W1 i* P1 G9 @+ l7 D8 N
}) e9 h/ J9 _% i9 P$ O
window.onload=populate
# ?( l  Q# b4 J& H* u7 p3 r" C7 x" O5 L' {
function scrollmarquee(){* g1 j9 J3 R7 ~, U$ B' I! Y
if (iedom){0 H6 Q3 E# y7 ~3 A, I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( X* I8 C% m4 @4 s) a+ p* w7 Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* H6 I4 d. ?$ L; z8 k, F1 o( E. t) ]
else/ n" r8 j9 ^- ^  {/ T: L9 O1 O
cross_marquee.style.left=marqueewidth+8
% i  l6 t8 b. S! b
5 _- _4 b: r) ?2 N- C}6 I/ o$ R8 h4 K9 y( ]
else if (document.layers){
1 j: J; C# x* c) {/ F5 \if (ns_marquee.left>(actualwidth*(-1)+8))
  ~! M% d) {, Hns_marquee.left-=copyspeed
+ ^! S5 X0 ~1 s$ t! ^. E4 ~! ^else
, N. J6 N( {( Cns_marquee.left=marqueewidth+8
3 G* W+ m9 h  x. J5 n# P}2 N: A( Q5 Z3 B' H, u# H( a
}
- d: u) t$ k, U" \. t6 m% ?
4 w. p% |; |2 o+ m! t# i9 Fif (iedom||document.layers){; J" k2 s2 k, K: L; S4 p+ a  C. }
with (document){
" d$ t( S2 S$ P+ }1 ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 ]: m: X" U5 K* i  V
if (iedom){
& _! M, X0 d2 M6 G* D$ m3 \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. K" `! T  C% L, rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 {# K4 p! ~. a. O: r0 `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 C# n- K, [6 k& vwrite('</div>')
: x+ A, y8 G0 c  r1 K; I3 i% U}* w7 Y6 s$ A4 ~* S% }& _, m/ ?
else if (document.layers){) X5 q1 ^. i( i( [# e- y1 C! \) L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ W% B$ i8 I5 O  d" F+ v
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  ^6 V1 I4 w, p/ B2 ]) T# o" b$ C' Twrite('</ilayer>')6 L! e' m$ a* g0 v
}
' j" g0 F% I" n& F2 h! T) Ddocument.write('</td></table>')3 c  R% p: I- E! H2 E6 w/ ]; @
}
, `( }  t" I+ M2 _}
" Z- [" d# y6 V- r: _% Y6 Y</script>

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