返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 x9 k6 P! f3 {( M7 L
var marqueewidth=300( z2 H6 `% I7 F) q: u) o- M* A
//高度
, G5 K" _  O  W3 ~1 B2 _% m! {var marqueeheight=25; X! i& [! ?( W: {* W; e% w4 Q( F
//速度(1-10): a* c. V. Y9 p& r/ v/ y* W: d
var marqueespeed=3
: _7 u1 i, I+ @5 L" h4 ?: J: x//背景颜色
9 ^8 l# d5 ?4 K, ^var marqueebgcolor="#FFFFFF"
1 ^' d& _5 N! ~- D; c$ Q//是否能暂停 (0=no. 1=yes)?# L2 q2 C% [+ }0 i7 o1 g
var pauseit=1. i' J8 h* v( k: V

3 I1 z. C; v* C7 N//修改显示内容1 a7 Y# L1 b+ v" ]" \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% f: h4 V4 y- A- v+ x  Z: d* D+ i5 p

$ M0 x0 k# c# [2 r% x/ s- m////下面不需改变////////////. R# d3 b* Z- I

, }! f* ]/ u8 q) z5 F) n' q/ ~var copyspeed=marqueespeed
/ l# B6 j1 V  `( {5 a2 Y4 Ovar pausespeed=(pauseit==0)? copyspeed: 0% k7 b! M6 L4 F- Q
var iedom=document.all||document.getElementById
  W4 ^- q& j  o; vif (iedom)
0 g  u, O; `+ d% @/ ?& Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). k$ c* a: j5 Z5 \# \, d4 x
var actualwidth=''& M6 ~4 F7 A% ?0 r2 R6 m9 z
var cross_marquee, ns_marquee2 L$ R1 z5 ]* d% I  R8 P% _
0 j1 \% b* H8 y+ P, U! f! @
function populate(){
$ ~( u) T5 n  mif (iedom){
* w6 q  ^) y! \9 X& jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% C& O0 e, @1 ]+ J9 d- t! T
cross_marquee.style.left=marqueewidth+8+ D& k. e" H" p# g3 T% U
cross_marquee.innerHTML=marqueecontent
. [' i2 a( U. lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, A" D0 f' `+ t, u9 ]}
/ T0 [; G" o- j3 k4 Telse if (document.layers){
: i+ i6 g" f, t" ins_marquee=document.ns_marquee.document.ns_marquee2
4 s. F# ~' X! n. ]: y' Pns_marquee.left=marqueewidth+8$ ?# A( L1 n1 T/ N  `. t7 m
ns_marquee.document.write(marqueecontent)0 T9 r6 H3 h" Y6 T) ]; @
ns_marquee.document.close()2 C( {  G* [2 D) L* O. R
actualwidth=ns_marquee.document.width. J! q/ z+ f/ I/ B/ u1 v' y4 Z- P  c
}
0 ^; ?! y! I( g1 X, L3 \lefttime=setInterval("scrollmarquee()",20)
6 {+ i  ]# W7 |3 j0 @5 A}1 ^/ @, t; T, ~! N
window.onload=populate
6 V5 T. V. }7 g6 {' a0 |  h5 F$ e0 i0 ~7 [
function scrollmarquee(){
* q0 Z. u8 v* i) k4 D7 Qif (iedom){+ ^- z7 Y4 n4 m( V7 \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  h( \" d$ |8 t  o# D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- z& J. G& X& R& Y- V
else
( H9 H* V3 Z' [$ bcross_marquee.style.left=marqueewidth+8; e  y  w  z7 v0 l/ d

# B2 ]( o( q; Z8 [8 E& B' o}" c1 m' ?7 t3 P+ P3 _9 V- ]- e
else if (document.layers){9 o3 w6 Y) X- |) ^: i8 F
if (ns_marquee.left>(actualwidth*(-1)+8))
* d, Q) p6 E) B5 C& U  \1 `ns_marquee.left-=copyspeed6 w# u2 q8 M& U
else
/ h! ~3 r3 v. `" n5 t* |ns_marquee.left=marqueewidth+8
5 X3 q! u8 D) L4 {8 e) |}; O7 U: e# y, L0 {2 u* U4 u
}9 S' j5 f5 J& J
% ~: ~- D; B- S; L
if (iedom||document.layers){& g, i- P$ y9 S
with (document){
; r% w' y* H6 Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 N# C, i  C" o6 H+ A: mif (iedom){6 h8 F9 m, M' O7 c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- u! |. H4 U) U8 {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 B: n( m( D1 s/ Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 U3 x/ W/ J& @& [0 x$ f
write('</div>')( H. v4 ?9 S* Y. p  M( O' J$ d' B
}
5 o! w+ F- [0 z3 g' M; _else if (document.layers){3 r) l+ U! W( q# p5 n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  f7 f# X& X, d- X) ?; Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; D  j" x0 V) m0 R+ ?# A/ Hwrite('</ilayer>')
& r8 n4 D7 K1 }- w& R* t}
6 \# z- ?' e) s! ]" p* u, ~document.write('</td></table>')
3 b3 T5 U, l! \9 u' A}
: [: f+ E3 {& ]( d' a& L5 [2 |- O5 \$ u}' W' a% {- i% U. q1 f0 m
</script>

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