返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: F9 l5 ]( w+ a5 l/ ?4 @var marqueewidth=3006 I8 O  c  O& _2 Q- w' P) f
//高度
% a/ W" ?+ J! X, J9 a! `# ?) Tvar marqueeheight=25
( Q4 O& m% L2 L! t3 T7 f" p//速度(1-10)
3 s% b# N% U3 E- B) Svar marqueespeed=3+ [% l3 Z4 t# ^, D% J  h
//背景颜色  p+ e# t/ O% `6 [
var marqueebgcolor="#FFFFFF"
" F! {" r6 U5 y  X+ x//是否能暂停 (0=no. 1=yes)?
/ ^' d1 t& m0 ivar pauseit=14 ~' k/ o1 {5 O, y$ V8 H6 _
0 v0 q3 o# |; q# Q  j* {
//修改显示内容
. x6 B1 y7 f+ _8 ?1 g' vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 P. V7 B( c5 @
+ a6 l4 h* n/ _7 t0 B

- q7 D& D$ N# x- c4 W# R6 R+ f////下面不需改变////////////  s% i! B6 t% i* s( @1 _

) e/ p7 p( ?5 X3 ?var copyspeed=marqueespeed% J; P9 O0 m4 I; X- o8 C$ O4 Y
var pausespeed=(pauseit==0)? copyspeed: 0
2 C* v* K. @6 D8 O$ cvar iedom=document.all||document.getElementById' e4 s5 {8 Y, r7 m! N
if (iedom)
$ @! z* t) d8 e5 \* [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ E' \0 U& L9 ]' M% k" @
var actualwidth=''% v7 x' z) y& a" o( u
var cross_marquee, ns_marquee/ ~- J' d7 n! Q

) o" g: S8 N0 D6 f8 s, o! t' G4 bfunction populate(){4 k' q: B1 h8 g1 P' G$ t3 B( z
if (iedom){' b1 |/ n+ l9 A  e3 n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& o. ~0 X/ V3 r  _
cross_marquee.style.left=marqueewidth+84 m( t0 O+ y3 h; W* i! M/ x
cross_marquee.innerHTML=marqueecontent
/ e0 ~" V; {' m  j$ h: J& Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! g6 Q# J+ h; k2 h8 X" l0 Y+ N}9 X7 t% }, Q% C& m& B% X
else if (document.layers){
+ J( L) ?* v; M$ Z( X3 ^8 vns_marquee=document.ns_marquee.document.ns_marquee2
! A; j: e* d) K) n6 ?; O- Qns_marquee.left=marqueewidth+89 O7 I2 n  J8 X2 U" Q4 N9 l
ns_marquee.document.write(marqueecontent)# Q& j: Y- L; `/ K9 R" w% O( q: G
ns_marquee.document.close()
, k: _& d- V3 k% H2 Dactualwidth=ns_marquee.document.width
4 b9 ^* t+ J2 [( f- {}
+ l) T) h3 A9 a/ d& u. w# S0 s) j8 [8 olefttime=setInterval("scrollmarquee()",20)0 z, D9 Y. \; }; `
}
: L/ x# _6 n! e$ m1 c+ ], ewindow.onload=populate
6 ^3 N% e; @5 V: s" v) e1 n8 r
% E0 T" i' \, H& }) `function scrollmarquee(){
7 ]" ~6 u' I, d: E2 H% S5 p: Nif (iedom){
* n" i: t  E) z4 L+ E0 H& E9 V* sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, {; Q8 E. \4 X* ^2 `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: W6 j5 {* w+ z/ N& d* H- t& _+ f
else: `: s% `. H$ R! q. a
cross_marquee.style.left=marqueewidth+80 P) X4 z% t* Y7 q% y1 l% I1 c

! O1 X3 f. i8 \/ q3 X! T}
1 O5 D, H$ z) delse if (document.layers){
2 ^& L8 v8 K* tif (ns_marquee.left>(actualwidth*(-1)+8))
- n8 j0 U' s. j" Sns_marquee.left-=copyspeed
5 m; n& W9 ]# s8 O' e" nelse" f: v6 m( `( P: Y$ @2 G7 f5 V
ns_marquee.left=marqueewidth+8
" \6 n# |- w: X# z  u}5 Y: H% |9 y/ v- `% t
}
, f$ d# N7 P  @  c2 {% \! z! x, u5 i* T! x  V
if (iedom||document.layers){8 n& _4 Q/ m% H3 e; O, ~
with (document){4 h8 o! }+ ~$ H3 ~9 P7 a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; S3 `- D. l9 gif (iedom){
9 m. Z% y3 |6 n  dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! Y( |1 N* j+ q$ s3 L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 m9 ?9 x3 ^! h- b: ?( E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* _& N9 t0 n8 X: v5 K  Bwrite('</div>')  U( J5 }8 @. [
}
8 R! ]8 V9 _% k( jelse if (document.layers){
0 |7 H! W5 y( U0 g3 j5 c- h% }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 p" i1 f2 y; W' p5 |write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 ~6 {  i) w; A, ~0 Pwrite('</ilayer>')
# N) `, x- E& {8 e- D}
! z% N  E, \' c' cdocument.write('</td></table>')
6 R$ N! D* x8 K+ d. t( T}/ j0 E5 P, q5 B% w- J5 S4 n
}
. h; o! \$ }$ @. Z& b</script>

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