返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 J& R( @$ s/ G; O, N- O) |var marqueewidth=300
+ R- H) |/ ~. n' e' Q//高度
7 V( U7 C/ i. B* Z! I9 Avar marqueeheight=25( Y$ W7 }3 p8 J4 g) |
//速度(1-10); t8 \0 O" ?0 X) Q3 g
var marqueespeed=3
5 ~; ?. e: ^: d7 f1 u7 D8 K" K3 s//背景颜色# F" m9 V0 m; Z
var marqueebgcolor="#FFFFFF"6 [5 A  I" U! @' p5 U
//是否能暂停 (0=no. 1=yes)?5 I+ Q5 b# I! }/ d
var pauseit=1
- v' X' g- R4 M2 _- u( g$ R# o% d3 ^- r! ~! z  c- Z" M; T, S
//修改显示内容- s( P0 s$ e- T$ T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 u: \% N' s& s& Z

- w' _  k) U) _+ V! s6 f) Z2 _8 q: J4 ?+ i1 q
////下面不需改变////////////
5 r- ~% r' S  `0 B
0 T2 k, @! T4 B2 d. w/ cvar copyspeed=marqueespeed
# Y& `0 c, j+ i; x3 }# d: v  ~# _var pausespeed=(pauseit==0)? copyspeed: 07 |5 A& M0 S6 s, J. t1 Z  T
var iedom=document.all||document.getElementById
' v8 n% r' s& S2 Z  iif (iedom)( S( h/ z5 U/ O# D3 `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! G! R, Q- E0 O0 }, {2 k7 W
var actualwidth=''! d$ A' q' b, \" |3 j: c
var cross_marquee, ns_marquee% m% w9 _$ d. K( [% G  [

; ~0 F2 E, c; l- Efunction populate(){3 w( H, a( M# _. `) d$ \) Y' C/ t: I
if (iedom){
* M) M+ D" Z  B1 l3 ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 i- m- f1 Q8 {/ h( U2 Rcross_marquee.style.left=marqueewidth+8
$ m+ ]8 v2 P& X& lcross_marquee.innerHTML=marqueecontent
1 a8 u( W$ V9 Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" I4 K/ t' B' ^
}/ ^% J' O. f* o
else if (document.layers){
. Q/ `  |8 m  j0 m3 R, l( Q) F! S7 I7 Jns_marquee=document.ns_marquee.document.ns_marquee2
3 m; P8 a3 _4 C! a2 Cns_marquee.left=marqueewidth+85 r3 x3 d- d6 h
ns_marquee.document.write(marqueecontent)  X) G2 ]: ^, y) P' r! _% z
ns_marquee.document.close(); S# \" Y" W' u! W9 k7 Y0 T
actualwidth=ns_marquee.document.width- |: o2 y1 e! `: `( M- N
}6 b( Z% U" T8 S. C
lefttime=setInterval("scrollmarquee()",20)4 j: o  t3 B7 `8 n, q# j+ H+ R$ ?
}$ D1 v0 H0 x. X" }3 Y0 }
window.onload=populate$ F% ~; w( \8 e: V3 F5 I( x
# H& T. B) D7 x+ J- Q& u
function scrollmarquee(){
$ C; C; R& a( y8 N+ r, aif (iedom){/ [: s' R  D! p) f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* N* V8 ?3 A5 s2 \" |# c0 r9 y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& p2 e* o  U$ W9 T, V& ^
else
3 U/ V" d2 @% _$ R; ]+ Z  wcross_marquee.style.left=marqueewidth+8# p! `0 _8 H* r
; G8 n4 r: |1 T3 U, y' h& C5 `
}
4 ~' S% T7 j3 b# @5 B* S# T4 x6 V; Belse if (document.layers){( I: Q# U( E- Z/ K6 P0 }' f
if (ns_marquee.left>(actualwidth*(-1)+8))( ^. |. Q# s9 J
ns_marquee.left-=copyspeed
: M* \8 l4 j3 z4 C, o$ n6 M0 Belse! Y0 B& u  b' ]% S
ns_marquee.left=marqueewidth+8
! o8 b& q8 Z$ m0 d! y( _0 t}% Q  M7 z  E+ E* E9 s6 ?
}
7 S0 n6 s. y8 f* N$ a$ I% J
! `5 k3 X+ n; p+ Wif (iedom||document.layers){2 t4 B1 m6 ?, f: N3 b
with (document){( f( c5 R2 S6 M2 E' f% i, b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 ~9 j$ I5 k  e( ?
if (iedom){1 W, A  `" j; E, f; ], R& u7 C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* b6 S' \3 }( V( F  j4 u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 z: W# }( U/ R  Gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ y' {* j* p, T/ Nwrite('</div>')) r& c9 @5 a6 v/ |3 H( ^. _6 ?
}' e8 y, b3 P, f( Q/ C/ n
else if (document.layers){
7 H9 h& j6 l6 W' g+ Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 A6 V6 C. R3 c1 L$ e/ I: a9 g8 ]: x7 _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, m  H* L0 L# R1 [- Iwrite('</ilayer>'). g8 Z  Q" d- f( h, O. [2 v6 g4 M
}$ }- K4 _  M% J4 `' D* ~+ z& L- V9 y
document.write('</td></table>'): I! o/ q9 P1 E; E8 T) `, P" l) B
}
- W" p0 q# R" q, }% S}" [3 S, O, M5 }$ m2 q$ {
</script>

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