返回列表 发帖

网页之跑马灯文字特效

//修改宽度; {; e/ u# U& G) O7 m1 n
var marqueewidth=3003 O; \3 p6 r' l7 r  h  r) u0 u
//高度
; m: U( p( g& M) bvar marqueeheight=250 `- Q# f; U; `* G" S1 ~
//速度(1-10)
  V" {: c5 F" @var marqueespeed=3
4 @0 ]" ?/ O6 A0 q, \/ D//背景颜色
' H- P. B# ?5 |6 ^var marqueebgcolor="#FFFFFF"7 H. {5 j+ B+ F& w3 j. V6 e
//是否能暂停 (0=no. 1=yes)?4 R1 X. F$ ~! s  r
var pauseit=1
" J' W0 l1 ~" H9 g7 C
8 }8 s  A) v  z//修改显示内容
" z6 ]' o% T1 s" u0 Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 j+ Y! }" `: x9 d# h1 Q

: U0 y6 M+ Q- H3 w" [- X
# D' K2 U; ^) m$ p5 G////下面不需改变////////////
- O: {+ _0 ^/ y7 H% c) |$ R8 D! w9 c. n/ p5 G  ^# ]' c: b
var copyspeed=marqueespeed
0 y! R0 S, z" c2 Ovar pausespeed=(pauseit==0)? copyspeed: 0
( x! k2 E  x) Ovar iedom=document.all||document.getElementById4 ]* s5 `( C3 q3 U) j# [  J) U9 N
if (iedom)% |) }* X8 z9 A% s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% G; T7 u  _# \  t, T3 ]# gvar actualwidth=''
* q% y" k7 @4 s, pvar cross_marquee, ns_marquee) i/ B4 H4 J9 `- z

6 T' S8 o3 m( z- o7 ~% A. tfunction populate(){& \4 P. o9 {* \6 p& u
if (iedom){
$ X9 E1 i! r1 ^/ R/ _/ N& zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# o$ R/ Y# \2 L1 Y' C5 J! `cross_marquee.style.left=marqueewidth+8
' W1 ^" d2 s' D( [+ h8 s3 x, C& Fcross_marquee.innerHTML=marqueecontent6 z/ r9 z7 |* d& u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: n3 u( C5 Y  n. \}" ]9 N. B6 p/ }; @- i$ B
else if (document.layers){% K, F9 ~  b8 p7 j- c% l6 C( I
ns_marquee=document.ns_marquee.document.ns_marquee2
( g3 s# A! F% G  x1 {1 lns_marquee.left=marqueewidth+8
2 g* _7 I' y8 i7 Cns_marquee.document.write(marqueecontent)1 c; A) R! R/ J! a. v4 ^
ns_marquee.document.close()4 ~+ g9 S4 g# ^. H8 {
actualwidth=ns_marquee.document.width! G, X, X! V4 P1 k2 C* s
}
  }0 y9 U: P& m1 O# \* o. B- Rlefttime=setInterval("scrollmarquee()",20)
  |* _0 ^$ ~5 [; \7 ?}3 `: Z' x: z% T" a) A
window.onload=populate
. M) S# d/ E9 q2 P7 `
; a4 P& l; L/ S7 P) g; Q0 D  l0 rfunction scrollmarquee(){1 K6 `5 G0 E! _+ d: Y
if (iedom){
( Q8 X/ ~# r  }' s  x$ Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! f& y0 V$ Q1 E7 H3 Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 U& G; n: _  @4 Celse
) C$ B6 e# }' y! a! [% xcross_marquee.style.left=marqueewidth+8
  ^! Y/ w6 p2 O4 m
! @- p2 c$ X" u8 v. ?! \2 n}' ~3 Q8 A. ]/ l6 }* A- d
else if (document.layers){' @& s- N9 b* s3 r
if (ns_marquee.left>(actualwidth*(-1)+8))
! v! I  i: w: p* |3 y  t& `ns_marquee.left-=copyspeed
; O5 b8 {2 e; I  ^2 Z# H: Lelse# N9 v$ L! r6 H
ns_marquee.left=marqueewidth+8
2 b3 n2 i9 L* b6 ]2 L7 L9 f# T& G}) W: ?6 a3 h: N
}
  ~$ O. w2 F, L( e- x
& Z) C8 G2 Q" R8 Oif (iedom||document.layers){: e. Z% ~& O2 Y* I6 _; A* a
with (document){
5 q  ]$ d2 U2 ]" |, ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: ^6 ]. c; V( u& D. z  G5 Eif (iedom){
  v+ Q2 c0 ?- x3 L& n; Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  p! b" p" A$ ?! j
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 }& r- `/ `3 ^( _" V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); h% N9 ^5 |+ C( x7 }+ E) I
write('</div>')
3 t5 h" y% N" h: P' C}
; `$ L) p: M" h5 I' M  T. `# welse if (document.layers){
- n' S3 u) B& r. O" M  p# u: Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 t4 R% r( W; W1 {7 _% Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 ?8 `) O/ y' ^' P0 d6 c  Pwrite('</ilayer>')
% v/ G6 f/ ^# p; ~1 C9 C! L}
, }3 a$ ~& q+ H- a% h! Rdocument.write('</td></table>')" P1 I: }% V4 \
}
9 v9 b  l2 G0 o  r}
  z; l, W/ g+ v4 v</script>

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