返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& }- F. `) l1 evar marqueewidth=300
& D2 g5 T7 ?/ S) h7 M4 E//高度
! X2 p0 T! |% Nvar marqueeheight=257 ?" I  o; G5 ]
//速度(1-10)8 t7 `* V* t$ c+ j0 I5 l
var marqueespeed=3
- `% M* s: X) m//背景颜色
- a3 i/ W7 Y5 r& A% X* z/ r. B) lvar marqueebgcolor="#FFFFFF"8 F3 }0 B2 t/ @! ~# s# C/ O
//是否能暂停 (0=no. 1=yes)?
$ @0 ^* V! ~4 F8 i: \, [# o: wvar pauseit=14 I$ z% h# O7 \) W* Y1 q7 \
9 w; d% T" A, i  j
//修改显示内容
6 n% j) g. j) ]2 `. P! dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ z* s0 g% H4 Z4 w9 A) l7 t0 J/ Q' V' S$ g% P
4 z3 v# w! z  V5 _. n8 g; ~. j
////下面不需改变////////////( O8 e" k- h2 U+ t1 e

/ u0 G; z& G, s; A( `; bvar copyspeed=marqueespeed
9 E) o+ `" N) X& ~1 Z# Tvar pausespeed=(pauseit==0)? copyspeed: 0/ R" W& b' ]$ d# I# y2 ~- g
var iedom=document.all||document.getElementById
4 z, a1 H1 y3 ]- v& pif (iedom)$ r7 n. \" w: I2 ?+ `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' q% H: [# B5 b
var actualwidth=''
$ ~: |! o/ K! A1 I. Z9 x6 \var cross_marquee, ns_marquee
' M  Y4 t: a8 U: A9 _  Y
. h' \; J% Q, D9 Dfunction populate(){
1 k# h' e6 P0 L; Y3 Wif (iedom){' m) {7 I# C6 i* j' {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 k3 f0 O2 F4 `- A5 Q- e# o( Q- V
cross_marquee.style.left=marqueewidth+88 d4 a4 v3 T" r+ }1 e' ~9 B6 _+ M0 Y6 h  e
cross_marquee.innerHTML=marqueecontent4 e0 V( m) Y, q( O
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 h1 ?& n. `& Y4 i4 R% g0 ]}
/ x* y) ]/ `. Y9 j( d" O. aelse if (document.layers){- {" |. x- `1 V' K# K$ v; O
ns_marquee=document.ns_marquee.document.ns_marquee23 E/ V1 B5 w6 D( d
ns_marquee.left=marqueewidth+8# N+ C$ C0 D% ]' S9 H2 Y' t
ns_marquee.document.write(marqueecontent)
0 ~; W4 e2 s( R# e  kns_marquee.document.close()
3 H; u$ T1 ?! X! R' Wactualwidth=ns_marquee.document.width4 Z* v+ n% k6 X2 M, _
}
5 s2 c. R5 d3 N8 w' `lefttime=setInterval("scrollmarquee()",20)+ P  S. w2 o3 l
}* m, e* l3 |2 k7 v, B
window.onload=populate. e* H( w# Q* k2 N
- c  Q8 M! b" w+ D9 o  ~0 u% v) a
function scrollmarquee(){3 b0 w4 C: t" L, e  N% e0 V
if (iedom){
; D! [. [& ]4 G% _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 N- I3 {+ O! L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, t0 f* \5 }; T% d, ~4 ?  X
else
- m! Q- x( n. b% Q7 P; p! Ncross_marquee.style.left=marqueewidth+8  f) |; r& W( ]8 Q3 l$ t8 D
  b0 O3 Q6 I) s9 `; B
}
' w+ p, [; S/ ]( |: gelse if (document.layers){
0 N7 O2 o4 l3 w8 L0 X& T/ Hif (ns_marquee.left>(actualwidth*(-1)+8)). c! P' m( a# u+ v
ns_marquee.left-=copyspeed( B$ F5 x) W3 e- h
else" {2 \7 i5 x# J' Z" [
ns_marquee.left=marqueewidth+8
# [" l/ X0 h& r: P6 v/ i" f2 U}+ u6 T& T- _  }
}
) j. F" N. ]0 [: |6 I1 p5 E0 L( C# j& u" F7 O% r  l
if (iedom||document.layers){; K( p  Q; }# x2 M* P8 {! _
with (document){
* y. j' A# u" f2 @5 ^% Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 h; {8 i' f9 d& @- t7 t) mif (iedom){
( e, S* u' a; J- C  i9 U. ^9 ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- g- O- {1 ^0 M3 S8 b: I3 E* cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( M$ Y: D1 l; O. W) ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ S, X% K$ ]( h1 C  J" K1 v
write('</div>')
8 v% O! F" p+ k}
# F& X) X' K/ y; b4 r2 Nelse if (document.layers){
3 ^- p: ~) Y3 _' @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) L" N( E/ M& B  k: u- C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! r' n9 P0 x) ?; ]
write('</ilayer>')- D- r: C6 G+ q$ H
}6 d4 X! B; j& g, i2 L. I$ Z
document.write('</td></table>'); H$ |6 o8 a% k( l  [$ z% j
}4 _1 G+ {" T4 C! L
}; G( e3 d% N5 s$ [  J
</script>

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