返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# z3 F" @  V' d5 J5 gvar marqueewidth=300. O$ s9 ~. u: m+ q
//高度0 W* c' R: C7 a) T) X& t! G% x
var marqueeheight=25
: v, g1 {6 I2 f//速度(1-10)! N9 f( x1 a- h4 u) D5 \3 f- a
var marqueespeed=3; T& x( H* w- k: m# I
//背景颜色
+ {, p/ X9 x$ F. w* h9 v3 Z  }( Ovar marqueebgcolor="#FFFFFF"  [4 }$ B, ^- K
//是否能暂停 (0=no. 1=yes)?' J; i! ]& x5 d+ K
var pauseit=1
2 b$ ]. l3 A9 o, R* I9 h# z' D+ \, R8 \
//修改显示内容3 F# Y0 Q# y: e  U6 g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 f  U1 M9 O- b( t
7 l( X1 _, E6 e

0 ^! A9 H9 L9 H6 [! Z6 E" L////下面不需改变////////////) G4 Q1 F$ E! t) _5 o5 @. f3 h: O
! Q8 i' V7 h- U( T" t
var copyspeed=marqueespeed6 A0 r; }% ~  [" w$ A; L
var pausespeed=(pauseit==0)? copyspeed: 04 L, k; R! W* H" q2 p7 P
var iedom=document.all||document.getElementById' E# u1 O7 O; |: C: p5 W
if (iedom)7 Q7 D( L" Q, T7 B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), j( i- `2 ]  N# @2 _
var actualwidth=''" U  U! W! F" L, v2 {, ~
var cross_marquee, ns_marquee' K% t8 L$ i) }" x( f" R( P
' o  _; G' Q  f" T4 T/ a0 H1 v8 R
function populate(){# X) f7 R9 n/ w7 M' V* B
if (iedom){
  c+ H' w& ?1 K8 ^# X( j7 ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! A) Z2 b* S; O/ J4 B  R: N0 rcross_marquee.style.left=marqueewidth+8
$ z3 C5 a9 Z; }: v  Dcross_marquee.innerHTML=marqueecontent
: M9 j( l5 R) sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 c# N% T" ?6 ], E! J& b}, Z4 R5 c/ d' I: P
else if (document.layers){
+ }) x  H5 ]# W" G" K! \% `$ N  Ons_marquee=document.ns_marquee.document.ns_marquee2
- n! O% ^+ x9 qns_marquee.left=marqueewidth+8
; l) e5 M& J1 u; m* n( Tns_marquee.document.write(marqueecontent): p" ^+ M* P6 B1 i) H, y8 O
ns_marquee.document.close()& p  @% z* P( M, [. A
actualwidth=ns_marquee.document.width
, |- a/ e- {3 b# W' b: C9 X}
; p$ J8 W1 _+ N7 T) Ulefttime=setInterval("scrollmarquee()",20)
8 x. j2 F; I& {) {}
1 N4 t6 s4 C/ ?" ?; B- I8 Nwindow.onload=populate
( \7 H0 s$ W% W) d# H, C  t  M# i6 U0 W' \
function scrollmarquee(){
1 J2 o5 e. W! Q' r: ~6 a# eif (iedom){
+ L3 c1 x. R: b5 @% m& ^7 r+ Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! U, `' j6 C5 r* w0 q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ f% E1 S% T7 [, B1 U" Belse
" n& ^0 V. Q# n: [' ccross_marquee.style.left=marqueewidth+8
& ]) k  J9 P( q5 x& ]+ i
/ |% s9 [" ?4 }* U# t( X}
7 f: `6 k  o7 K* F1 |: gelse if (document.layers){- z$ ^; J5 U1 _1 K+ o
if (ns_marquee.left>(actualwidth*(-1)+8))
& B/ |8 a# c2 y% Zns_marquee.left-=copyspeed7 V) n8 v1 G9 ^6 d
else; }7 L2 R. |; Q5 F0 _
ns_marquee.left=marqueewidth+8) `7 l$ B  r( u* a( ~& v9 J
}
2 ]# |9 J3 _3 ~}
! g8 ~9 Y8 o: Y% _6 u! ]/ v) R! X, Z6 E- u3 f
if (iedom||document.layers){, Z. x$ d# y4 f7 z
with (document){9 ^7 e5 k" q- D, R9 l0 p, s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): f' L0 [/ X. @
if (iedom){$ C3 |9 }6 ^% x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  M0 x; Z- X. e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( A4 k0 N- {% F; owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ N; m# v9 n' o) t' m+ Iwrite('</div>'); V. N2 |& @. z- R* ]& O" {
}
( l* D6 j4 m/ d, Celse if (document.layers){. Q( a, ?9 A& x6 k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" v; h9 \5 t( P" D. C3 b5 X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 o5 s% u6 y' i& ywrite('</ilayer>')
* ?6 \. D8 j- ~7 b; j- `}, r! y9 I/ O( X
document.write('</td></table>')
( W: T( R# B$ O. v7 {( V3 U: J8 }; |}4 A( x+ w; f& O$ D4 `; u( x
}
5 C  n4 X  J6 H: H# j) |" k</script>

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