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

网页之跑马灯文字特效

//修改宽度1 |% c2 x: n. w
var marqueewidth=300" t2 R- r: I( \1 O9 w2 _
//高度
6 G) r' G, D# h( Y2 V/ u( K; k/ Evar marqueeheight=251 B1 u* h" I6 Y" e& e" W# w
//速度(1-10)
. q  _- v9 I& B8 g  Uvar marqueespeed=30 N0 W! t' B# m8 D7 `0 Y, X
//背景颜色
# @% v. e* Z' nvar marqueebgcolor="#FFFFFF"' d% p$ r: _7 C
//是否能暂停 (0=no. 1=yes)?9 H) E7 m( f5 _2 j8 a/ f7 P
var pauseit=1
2 ]2 m6 ]6 e0 k( a4 ^
5 H5 T! ?3 \: d  {' Q8 P4 j//修改显示内容
$ R, d' U# ~4 c% Z# @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  ]! J5 I7 k* e! F3 P) O5 Q

  M  b4 l9 Y& ~0 E" s3 k; a7 e/ y, F$ Z( G/ j! v: G! ^! [
////下面不需改变////////////+ h; `' k; g. e" n+ d( H

: m8 Z$ [' m( rvar copyspeed=marqueespeed
( `4 F$ ~+ d; f/ Wvar pausespeed=(pauseit==0)? copyspeed: 0
# _3 h1 I& z/ L2 Vvar iedom=document.all||document.getElementById% m( J& y; r" v7 g; \+ I
if (iedom)" O( F+ r( {: M0 I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 A2 _1 X% x# R4 H& n& Vvar actualwidth=''6 o8 N, M- D1 W- e; r
var cross_marquee, ns_marquee7 z7 w3 b/ o, y4 T" J9 b
( e  D3 K& A' q  c
function populate(){, _& \" U9 U0 {* v3 x+ e
if (iedom){
9 s6 f7 P: v/ z( G: mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* S2 J- }4 Q( O8 K' L- ucross_marquee.style.left=marqueewidth+8, T! E# u6 d! v
cross_marquee.innerHTML=marqueecontent& n) a& z4 I! n- F2 E8 L+ w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 h$ v8 Y5 J9 v8 [}
) E: R8 o( S% i8 B/ E5 O2 I  Helse if (document.layers){
( A! q: v2 [0 P, hns_marquee=document.ns_marquee.document.ns_marquee25 h* A5 {+ }% n9 ]
ns_marquee.left=marqueewidth+8
# ^- i8 y6 q& xns_marquee.document.write(marqueecontent)
1 b) p* S: l* |  U) j, ~, H+ T, Dns_marquee.document.close()
- t, [9 ?* G+ P0 E0 I7 yactualwidth=ns_marquee.document.width, U& f3 j. U1 `, `: |
}
  b- B3 F  M7 b8 H7 A: Elefttime=setInterval("scrollmarquee()",20)
/ l. g8 ?: d* n$ a, u3 f) F}
, s/ M: D/ `% g- D0 l0 P  Uwindow.onload=populate. }- `: f8 }: L! g& L. w, {
8 d: J( `" q* E5 Q! j* F
function scrollmarquee(){5 ]( R* d8 `" }8 [. C
if (iedom){
% }% C- l1 `. _0 x" q5 ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 Y# l: f3 V8 ?6 |( |  W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# Y" V9 L" z: Melse$ k( |* ^9 C9 ^; J
cross_marquee.style.left=marqueewidth+87 t5 ~3 K0 f1 x1 i' [: u' I7 i
$ ^& L+ N. u2 {: a, O! K& ^9 \5 Q
}
$ ~1 B) c! X* D/ o1 @+ ]2 nelse if (document.layers){
" }" V9 I; w! I0 Z( rif (ns_marquee.left>(actualwidth*(-1)+8))( \) g2 t6 _" ^9 h  m! `
ns_marquee.left-=copyspeed3 p; d; j; j( U8 k& p9 `0 {
else! N% \# H1 b* V- k% j
ns_marquee.left=marqueewidth+8
& U# b! _/ F5 h0 S4 x* L}
# M8 D/ }- y: O3 m' F' t}
- W7 _/ c: M) |$ A
) w$ E0 n( N- C" N8 b4 R" ^' @if (iedom||document.layers){0 A+ u/ c1 S5 g1 o+ `3 W4 N
with (document){. w1 v* r7 d* n$ `" @4 w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 r! V. Q  f6 Y/ Oif (iedom){
' |! e: p  r/ ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: c5 z/ n  E" pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 J9 N+ ^2 s1 V3 V# d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); U$ @0 l, k- P5 C. [0 S5 R8 W
write('</div>')
7 \+ o* I9 u/ F}
5 E* |; W* s* [6 G) Q$ |0 e' a5 F' @else if (document.layers){: z$ v5 y$ c2 ]$ h3 T" z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  u, D3 b7 s% T  r2 S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ a0 E) J) {4 S+ V0 E, P# Kwrite('</ilayer>')8 ~, g, i' C' T
}
1 U* E3 r# O1 ^document.write('</td></table>')* z) w, ~2 h6 Z% Q" M
}
  |& _; D8 i( l* [1 `' ?2 r}
8 T( N0 ~4 k2 y+ h, ~</script>

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