返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 n5 B( Q: e* ~0 k' S& B
var marqueewidth=300' \9 N- h9 ^4 u& R6 p% t
//高度) H# }6 U: U/ g, O0 \/ O3 V8 l
var marqueeheight=25
$ P( L: A/ `0 B  @4 Z( n//速度(1-10)9 k3 N  u/ L3 U8 v# p
var marqueespeed=31 R% w/ o- T$ f7 e
//背景颜色
6 ]9 e1 h/ V4 h& n; ~var marqueebgcolor="#FFFFFF"
- \( B/ Y0 H/ S1 V//是否能暂停 (0=no. 1=yes)?
' }6 p$ L7 h9 `# R* p# N5 |# P/ Cvar pauseit=1' e5 ^: K' ^. c; ]! B- ?. W3 M0 L$ K
8 d) q0 h# K( j3 R' T2 M) P$ f
//修改显示内容, o( R" ^1 L) f/ R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 B% k' N, s) \% ?- q  W, F/ m/ q: K
/ c, i9 P% }" ^9 m& @# V
////下面不需改变////////////, h- H( O* u* n; {  }$ o5 w
7 ?$ t+ l. U; y& b% i2 E/ }
var copyspeed=marqueespeed
- ]# {8 J/ @# y# m! A5 |var pausespeed=(pauseit==0)? copyspeed: 05 c' Q; b5 |2 z$ J1 r
var iedom=document.all||document.getElementById! B! a- `% j7 c0 P
if (iedom)" y$ q6 _: y+ K- m4 [  B8 a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 Y8 h  c) C8 A7 N4 mvar actualwidth='': n! y( h$ W  ]& ?3 z5 b
var cross_marquee, ns_marquee' A9 m5 `# [* o1 V! A8 s8 {. s
* _* d; I' Y: t& p$ E
function populate(){
9 ~$ X* u+ {9 m. \. |if (iedom){4 ^. F" w9 F/ F- _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! N1 U6 P8 Q9 O$ V  wcross_marquee.style.left=marqueewidth+8+ [/ }4 I& j$ Z) }0 L" y
cross_marquee.innerHTML=marqueecontent
8 x7 G  c% f" I" |5 I  cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 f/ t" g( S" L7 E
}
( i. C; R6 b! velse if (document.layers){; i5 v  l8 U5 {+ {$ ^1 P
ns_marquee=document.ns_marquee.document.ns_marquee2  J' d9 y% y2 T: T) k" x
ns_marquee.left=marqueewidth+8
' y% K' O2 y3 F6 e5 ?- @' ?ns_marquee.document.write(marqueecontent)1 ?" o3 v* ?( r8 }. a
ns_marquee.document.close()! {5 {0 r1 F1 P* R9 b( ]4 {9 u
actualwidth=ns_marquee.document.width
  ]3 }- _/ V0 T5 K$ {2 m}8 x6 J/ K& X* G8 \( ^( G7 V0 X
lefttime=setInterval("scrollmarquee()",20)3 C# g" `% I9 F: N; Q, u% j
}2 }6 b7 [, Y. ~* Q& s
window.onload=populate
& c+ W. W7 u) S9 j3 O3 x4 A
4 }7 E" b8 k" p6 ^3 {. G/ \function scrollmarquee(){. B1 V3 n# I# Q5 K( l# R5 |# M  H& r+ n
if (iedom){9 _7 D4 d4 |& I2 F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 F$ f$ {0 h& v+ q8 v- o! k& ^! {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 `, z+ Q( {* z0 f* |else) g$ c7 `! k, i6 m) S: ?# I6 x* c! |; H
cross_marquee.style.left=marqueewidth+8
* k0 B3 ^, [  G+ L" I4 F( H; q' x! H  b
}
0 X% a" Z8 Q; U6 v* F- Uelse if (document.layers){
) h; C% L( |6 \# l9 y. H3 Mif (ns_marquee.left>(actualwidth*(-1)+8))
7 q' \/ p$ Z  Y, Sns_marquee.left-=copyspeed
0 B) t! I5 z+ D5 xelse
# K- A8 f, x' Gns_marquee.left=marqueewidth+8( v; j. r2 B$ N
}2 y% {: I- ?" |$ y' @1 y' F2 y
}
# a% Y2 ]1 L5 R2 q, j0 m
, s" L9 p4 R; W+ ?2 qif (iedom||document.layers){# x) R, C3 Z6 ?+ X
with (document){
& ]; Z: J: W2 F8 u* Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# ~# }4 C* |$ U0 y9 m" Fif (iedom){
1 ]: k. H+ s! f& ^0 G( P2 a1 ^& Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! V. p: W1 d, u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: ~5 L% Y0 F" \7 ]- xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ d& ?1 P0 i7 D9 q
write('</div>')3 |+ r' {- ^, L0 ]. c
}
3 D2 T1 Y8 Y; Aelse if (document.layers){( a4 U6 |5 P& c# M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 |( e0 H& }+ a7 C4 `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& k, A, ^: ~; t; c
write('</ilayer>')
0 t* W* {' C; x5 {3 ~4 T: l$ @+ V- a}
  |6 D& Z+ {7 d* q, f5 Wdocument.write('</td></table>')
: S0 P8 y1 r2 B. H3 M' }}( d( d4 W+ f" ]* j  ~  a
}. u6 W2 L" G- D% h  z, h7 V8 d* y4 u
</script>

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