返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. E; V2 e1 C) E' c, l# n$ }- D3 F2 fvar marqueewidth=300
" u+ p0 ^4 z$ C3 h  g' Q; y( w+ {- ]//高度* e: E; }) P4 z* k
var marqueeheight=25* x) A- x, Z/ w
//速度(1-10)
& m6 I, k0 T  d. n9 Wvar marqueespeed=3$ _3 N1 y1 W7 q8 E
//背景颜色! \& w: n" |. U4 [8 V
var marqueebgcolor="#FFFFFF"
" [+ r' m0 w0 f( J7 G3 ]//是否能暂停 (0=no. 1=yes)?% K) c* x: x* o* t1 P1 K
var pauseit=1" X( {) ]  R$ u/ u" e) K! [& Y

& ]# v; H+ p+ j//修改显示内容
  V9 ?# {& {8 T; O- ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 y9 N7 Z8 Q# F$ \; ?" x

( x7 C! B; J  z& O, J8 l, ]. e0 c5 T
////下面不需改变////////////
9 h* V% P' ~* M0 Y+ D4 _, z! I# m! z
var copyspeed=marqueespeed7 D; ?0 O4 |" Q0 V. \
var pausespeed=(pauseit==0)? copyspeed: 0/ g/ g& P$ \) z" c1 ^. F
var iedom=document.all||document.getElementById1 p) O. Q9 }- I+ f
if (iedom)
$ `* m- G% t' x& P# F0 g( A. R# [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 `: w* s1 Y. y# }! h% @
var actualwidth=''8 w3 d) H  ]8 F3 D; k- N5 R/ o
var cross_marquee, ns_marquee
5 T3 D: ?, U& x/ l, c, e) K- h0 L: s3 s9 f2 E
function populate(){; N: Q  \: Z3 ~, P) [  \
if (iedom){+ k- x" o" t3 Y% z: I! w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% A9 E- r& n( c+ k
cross_marquee.style.left=marqueewidth+89 R$ R: P% E- v- X" s" j2 V
cross_marquee.innerHTML=marqueecontent6 y/ R5 A. _4 [9 R7 s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) H! E  P; X4 l' I; E! L}
8 E8 o0 J. a2 Y% v- f, a# o$ zelse if (document.layers){, ]# ]' a, J0 m9 V4 A
ns_marquee=document.ns_marquee.document.ns_marquee22 M) N! R7 `* ?
ns_marquee.left=marqueewidth+8. Z) c& I6 ]3 q1 P) A
ns_marquee.document.write(marqueecontent)* s3 f; g8 O. H" K2 \/ f
ns_marquee.document.close()
% |, r& c6 K: S; ]actualwidth=ns_marquee.document.width0 W& s5 y& ^8 p* Q8 q2 W
}. J6 H3 R! L% t# I9 n3 g  I, q7 L
lefttime=setInterval("scrollmarquee()",20), u" u3 Z* V3 H; C4 p: ?4 R8 F! w
}0 E* O1 o* k+ t7 k
window.onload=populate. |# R3 w& ]% i+ {: |
/ J4 u' e' r! [# Z' c8 h2 p$ V5 [
function scrollmarquee(){
, E1 W6 G1 ^0 t* w- |: h& e+ L1 U( Tif (iedom){
3 h% m1 m: U( J* I( ?5 `4 H' @1 Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 ^! ~5 v$ l2 u2 X$ l. F2 v4 jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 ^2 _) e7 h9 z. j0 u
else
- Z/ z( v  C% o/ Y+ H( p! dcross_marquee.style.left=marqueewidth+8/ Z* q4 x% x3 Z% _" @! @
( }" O# W9 @+ i& k7 d8 E) C0 k
}
7 T+ X5 L+ T& P! B& u0 v" Oelse if (document.layers){
# q+ e9 V+ H7 H. E: k3 sif (ns_marquee.left>(actualwidth*(-1)+8))% N( J& y6 ~8 R' ]: x. |7 ?2 w
ns_marquee.left-=copyspeed2 W/ g$ l0 b$ T+ B( x9 f6 B
else
# k1 c8 J) V( w% Y- A! x6 ~ns_marquee.left=marqueewidth+8
8 W9 k$ z/ D  u; W* M}
9 S3 i1 t7 y" i9 w' b}
1 C+ o# K/ `6 L, F6 F1 ^8 U" L6 k* L
if (iedom||document.layers){; b- e* X( K, T( c
with (document){
4 l& R! b$ M# [* ]% jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ d' S6 Y5 D7 z9 l! m
if (iedom){
; f6 x) I# E" o0 Z' F& z: kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( L6 g& m$ N5 s- @7 U2 l* I; Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 [0 G( w' W8 g) hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 T5 ^5 q/ g9 W  t! r# ~
write('</div>')
1 l' J1 s. \" _- o. H3 L6 B}
; u, O& U3 t, E* j; Ielse if (document.layers){6 m' E) @( l6 l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( P  u4 b) K* v7 N, F/ x' v  G  I) H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' L3 h! Q( f; P% n$ _* f7 v" [/ P# pwrite('</ilayer>')
# O7 ^" G6 J8 b; E2 ]: a* ^}+ K: s. \! w+ }9 k
document.write('</td></table>')$ @3 J/ U7 @. p/ Y, }4 w8 a
}6 M" i. p, p* v% E. [9 u
}
2 U6 g0 q; s- D0 I3 Z, I</script>

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