返回列表 发帖

网页之跑马灯文字特效

//修改宽度) k, l' r5 H! J0 J. C- \9 ^3 |
var marqueewidth=300
; D; e1 [2 h3 j; a5 n% u9 Z//高度7 _9 ^/ q3 M: i4 V, d% l. @
var marqueeheight=25( H7 C# }# B1 \7 ~( I, L
//速度(1-10)
/ e' n1 ^2 c# d! }var marqueespeed=3
7 Q) p; d* ?/ g' {7 o//背景颜色2 K% l) K8 [+ d
var marqueebgcolor="#FFFFFF"
& Z9 ?: U0 X, l5 f" R//是否能暂停 (0=no. 1=yes)?
! R8 K4 e5 U3 uvar pauseit=1
* Y1 ]$ i) u! u  U4 y
1 x8 J( `$ U6 v) x! }' _//修改显示内容' U1 q2 F+ U/ Q  m# y" U  X( o6 `, T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 V& G+ {. ]7 X) a* A  [1 Q

& ^+ z: C5 `" A1 F/ q! K$ @4 h5 j1 y. R
////下面不需改变////////////& Q) G1 ?+ y; V6 G3 ~5 R: U
7 L9 a  w( a/ E) F3 h) g
var copyspeed=marqueespeed
  x! X' a: v+ n0 W, mvar pausespeed=(pauseit==0)? copyspeed: 0
! Z9 }# L6 l2 d0 k3 B" Lvar iedom=document.all||document.getElementById
$ S8 j' {' k* j/ i  ]if (iedom)
! f; h: x$ E  L" {0 P' j  l" Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" F2 \$ \5 Y) h& N- ^/ Ivar actualwidth=''/ n2 K* E) H3 O) U7 D
var cross_marquee, ns_marquee! I2 n+ \( E7 a6 M
! Z8 |. o6 G! m5 u) g6 s. w) o
function populate(){
% F  p% v3 x. w3 `$ E  ^- @+ t- Aif (iedom){
: _, D" n$ y/ V- W/ |3 Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 b6 R( D4 Z5 G  b0 ^9 _cross_marquee.style.left=marqueewidth+8
. w  E  s2 T( P8 d$ Xcross_marquee.innerHTML=marqueecontent/ a( s, W& m% ~3 G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  u% l$ i! _/ F0 L- D* W' t
}; t4 J* \! o0 ?: i
else if (document.layers){
, W& ]4 o3 m0 ^ns_marquee=document.ns_marquee.document.ns_marquee20 M! m! w! |7 y1 A2 Y: V- z
ns_marquee.left=marqueewidth+82 e8 d) `& A: y3 \8 C2 H; `7 y
ns_marquee.document.write(marqueecontent)
7 G8 U8 [) H+ N( T" I( C& ^$ _ns_marquee.document.close()
: c/ S1 j& y/ G; ?, P5 vactualwidth=ns_marquee.document.width
. R8 g* B' p) G: l0 c4 i+ b}
& x* o' _) ?3 c: Dlefttime=setInterval("scrollmarquee()",20)
2 R4 ^  E( Q  q! x4 r}9 d* F% Y9 K3 ?# x/ _
window.onload=populate
7 }) s6 ^. k! j- K3 l! ]
% Y7 p/ v% G6 R6 _8 w8 n3 gfunction scrollmarquee(){
" M1 Q5 W% `  c9 P  {5 }! Lif (iedom){
# N- c' `- |$ m/ a9 g% q: c2 |, eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 t& [' U1 z2 [% }! B! T( p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- P1 A* g9 H# R* F! }: ?else
+ Q; n# b5 Z& V0 Icross_marquee.style.left=marqueewidth+8! F  J/ n  ?  m

2 X' k2 x% @& p1 L  X+ G}( p% |# Z3 R* Q! O0 }
else if (document.layers){
$ L' K6 ^7 g# m0 }, W& ?, g  Uif (ns_marquee.left>(actualwidth*(-1)+8))6 j8 Q' c- d  ]) n& C' r
ns_marquee.left-=copyspeed
5 p! W; O0 K  a5 ^$ Z, aelse5 j* r1 S* \; ^( s; r9 `3 Y; ?4 q
ns_marquee.left=marqueewidth+87 V+ N: N/ y1 B" p* Q5 J" q
}- q% m3 p% `& T2 T+ C" \
}6 y! m# e: h' [% W

1 Q( f# q( E6 Z7 D2 Y2 e* U& k& n. Fif (iedom||document.layers){
7 y* Y: y, F2 L0 Bwith (document){8 u) ^- k& Q7 q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( f! x, _4 _  q! xif (iedom){5 ^. ~9 a3 b/ {/ p; ~4 y4 _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 e/ R3 _% J( i& cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 f: X9 V' M+ B' A" p' @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), k+ N" h+ D* g- S, A% `6 M
write('</div>')
' e2 ~8 \) V9 N8 x}9 @, n1 g8 N0 |$ W# U5 v, M
else if (document.layers){2 U; X* b4 G& w9 `2 H/ r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 l! p9 X' h5 D* qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 R/ R7 v/ ^& W1 xwrite('</ilayer>')
( n( W& r3 O4 G: q}$ j) }* G1 P# N
document.write('</td></table>')
1 r4 Q+ o+ K/ b3 ?}
$ j4 Y" S8 j* d* B' d}) x" S* V$ S8 O& n
</script>

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