获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# G2 ~6 s/ V- G' V8 e  D% I$ `var marqueewidth=300" D, e) G$ U0 B" n2 y" J
//高度# P: {7 M3 a/ }# o
var marqueeheight=25- P: ^- ~. I% e4 y
//速度(1-10)
4 Y) w+ U0 d3 p8 s% Gvar marqueespeed=3, a$ E8 P! S" }
//背景颜色/ ?/ z! k0 j7 D4 {0 F
var marqueebgcolor="#FFFFFF"
/ q5 `" n; p" p& C* r6 P//是否能暂停 (0=no. 1=yes)?) P$ g' B' J4 P
var pauseit=17 t* ~* u( V- H
- b8 o2 F" J. a: i. f
//修改显示内容
0 \5 F0 R$ I. |! b7 ?# i' Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# Y. y% T& i% P$ q6 c+ E0 {& g

* h3 w4 K  e) G: v6 Q1 ~, F9 T# H) g2 t2 r" _
////下面不需改变////////////
9 c9 G4 j2 c6 t1 L7 }
- W; A- ~7 ]* C6 {4 b3 z. S- p+ jvar copyspeed=marqueespeed
8 w( x0 s5 l* V$ h. g/ pvar pausespeed=(pauseit==0)? copyspeed: 0; |4 i9 E* a, @: a/ h5 q  P# x
var iedom=document.all||document.getElementById0 [: o4 I% W( Y: f1 v1 D+ Q
if (iedom)/ o  E  u, J# a, R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 U& y# b* N  @. z* H& R5 o% Gvar actualwidth=''' a/ ^4 X5 Q5 J: @! y
var cross_marquee, ns_marquee
7 D3 N' [* }( v0 D" e( \% ~& G
- p+ M+ o5 X! O  c" l% s9 gfunction populate(){
- N: P0 S- }: ^: Q$ |( Lif (iedom){
2 |5 }7 d/ r6 `cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 l. V4 d4 |# U2 Y! s, P- l6 Jcross_marquee.style.left=marqueewidth+85 W9 b, L$ ^9 ?
cross_marquee.innerHTML=marqueecontent
+ C5 V( J/ T# d, ^. S# |actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* B( ^' H& j( Q5 x% f
}  W, `2 i* }8 p- [
else if (document.layers){
' ]' W5 K5 x: y3 b3 r  [* Dns_marquee=document.ns_marquee.document.ns_marquee2
9 w3 ?; t  ]7 y5 j, Pns_marquee.left=marqueewidth+8
' A/ m/ q1 |  \4 `' _ns_marquee.document.write(marqueecontent)
: C6 f" A4 ]% T! {' w3 Jns_marquee.document.close()
3 G& W) v+ ~' Qactualwidth=ns_marquee.document.width' u& K# I" ], M
}4 a( H' l, U2 O% p
lefttime=setInterval("scrollmarquee()",20)
+ E  ]& ?5 p5 |# h}+ M# Y* u4 i3 z
window.onload=populate
) H2 n4 t& @1 k" v. t! E( S% b$ N1 j: K! \: A$ \
function scrollmarquee(){
4 ~5 Z, _& b. O* `! Yif (iedom){
, `" o/ B4 t+ E4 d  e- S/ cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& y4 }4 A+ r0 Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 U$ S% z* s+ S  U% welse9 f$ r* r  y$ q; t  k
cross_marquee.style.left=marqueewidth+8! D$ S1 ?" b2 f3 Z1 i2 s3 q7 Q3 j3 D( D

# Z1 c7 q% R) G9 l4 K}: @  U! B, p5 N- F4 ]
else if (document.layers){8 S' Z  i6 `& z# C' C6 G, J
if (ns_marquee.left>(actualwidth*(-1)+8))
6 a! L* A9 w8 j% vns_marquee.left-=copyspeed
- B: {/ p+ B; Felse
! v# g, k; g) {+ ^& a. t+ cns_marquee.left=marqueewidth+8( Q& @8 ~- N1 I9 G7 [# n
}
* t) c2 d9 A! V' K' A5 j# M. c: v}8 E7 }( _4 N0 j1 e9 |
7 X0 ]6 F  J5 }9 r% t5 V* Y6 O
if (iedom||document.layers){
2 ]& f) y! w: ?. o5 x8 u, Q- u& Fwith (document){: `& x& n- R- Z( z% o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). |* c6 W7 f  V: K
if (iedom){
  ~# x7 n4 y- w& x9 h5 x1 ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% s$ D: I7 @* ^; [& J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 y, w: k" C3 e, p3 j! `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); g% m9 [1 n0 z3 A, E7 W% P! N
write('</div>')+ g/ T: g; j$ X- s9 W
}7 q0 q* d; v4 h4 t
else if (document.layers){
6 R( s% ^, G  |* R% O0 L7 Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# V3 L& L. I- F! w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 @( z0 ], q$ F- {' b  _% u0 hwrite('</ilayer>')8 v) K9 Q( }( U& a" R
}' x+ ?+ y4 a  n6 `
document.write('</td></table>')
6 N4 I0 Z) S) V8 T1 R- ?# w}
$ W& S1 i2 _: k}. A# N) y- ?4 k
</script>

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