返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 d6 {8 _# |0 N7 x9 `: I0 \
var marqueewidth=300& A6 z" }  ~. F5 f, W
//高度
+ ]" Z+ M5 t6 z* j# }( ]var marqueeheight=25
( s3 w: t8 W# [. \7 K! n  T- V8 q//速度(1-10)
1 U' h/ C2 `7 m9 `! q- `0 A( S* Nvar marqueespeed=3! y; Q: x4 ~, c) v: d/ v$ T5 i
//背景颜色+ s$ D4 f: n, @+ R( f
var marqueebgcolor="#FFFFFF"
5 T; U) V" Y  ]4 ~* @' v; _- q" J//是否能暂停 (0=no. 1=yes)?
+ I# b5 _6 f. \, N1 Yvar pauseit=1; Y3 q* t% o9 W) j

, h+ }+ J' p' q. A//修改显示内容
' C! Z* M5 A* \) X) e2 K5 N/ O# X" Lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# d* V% O' F8 L5 n/ Z" i/ }0 T8 @( z  k' ?' `) G) b
1 _7 y; G& g7 q5 d) e1 z& X5 {+ M
////下面不需改变////////////* p0 i& h+ J, M- o; p! L
4 o+ f$ b! w3 \7 t& U7 f: z* A
var copyspeed=marqueespeed2 J2 a) [- ~  J$ m5 N* v9 ~
var pausespeed=(pauseit==0)? copyspeed: 0+ L8 |, `, k  V
var iedom=document.all||document.getElementById' v5 U6 K# T8 _  m  k
if (iedom)* N: d  I8 ?* ~" ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& P: ~, _# M: T! S5 ^! S0 m& S
var actualwidth=''5 O5 o+ Z1 ~. e& [0 b( A. `
var cross_marquee, ns_marquee
) ?6 t( g3 Y% i9 h- f4 R1 M: W( Q1 \
. [* c0 C9 l9 ~+ W) J; Hfunction populate(){! n8 s4 B3 i; B7 d: {
if (iedom){/ a+ a+ i8 B. Z% k1 G( d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; G' X$ _# w3 F: Kcross_marquee.style.left=marqueewidth+8  g, E% M; |$ o
cross_marquee.innerHTML=marqueecontent1 I! Y9 ^, Q4 Y- X  o4 O
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 ^" f5 R7 [3 M2 V1 |
}
' @4 t! ]( [, v2 q! K( I: k- s  Z$ Delse if (document.layers){1 z5 @) e) v5 T/ {, w. n
ns_marquee=document.ns_marquee.document.ns_marquee2
  U/ |7 u6 z; K& [ns_marquee.left=marqueewidth+8) X& f* A9 H( ?- r; p3 Y8 W+ s
ns_marquee.document.write(marqueecontent)
: G/ A( T* g9 i  uns_marquee.document.close()7 h1 g! ~: c' E9 w! z
actualwidth=ns_marquee.document.width: i6 i. o* g; S- ?( {0 Z2 d& b
}
+ {# w: o  b7 Y3 p, plefttime=setInterval("scrollmarquee()",20)$ S) y; u/ P1 ^) z7 Y
}
3 D5 `- u& @  lwindow.onload=populate
' [0 ?7 d8 Q$ C- W+ E+ F' W* ~
6 G* g" o; R# c9 y. f: m# bfunction scrollmarquee(){, E" Z# K& s$ b. }, L3 B. Q8 {
if (iedom){
) Y& N2 F/ B6 q8 v7 Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% D6 i0 ^, n# b+ q" d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ d+ @& o+ _! q& S0 [
else
4 f! |8 B  t: _1 V! c% d5 k4 Xcross_marquee.style.left=marqueewidth+86 }3 A5 X$ Z2 j, {9 s

. w+ q* K) d; F: C" V}
1 F8 h1 [0 F# Ielse if (document.layers){
4 A: v1 k" N; c- k  bif (ns_marquee.left>(actualwidth*(-1)+8))
" q6 c- |1 P& c4 Lns_marquee.left-=copyspeed
+ c4 U1 X$ U# S# U; P% h; Oelse; ~  Z1 i% B1 A# M- U
ns_marquee.left=marqueewidth+85 A; H1 U" Z/ ^% T$ }
}
$ u: {/ |  Y2 }" m2 e* y; F}
% g4 |4 o( a3 A7 c, X1 K% k2 M4 ]1 g2 G
if (iedom||document.layers){
0 N: ~2 n; }  o; |1 ?. qwith (document){' d8 t+ z( i% x' U/ U* G7 ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), u( u; m; F3 h9 R' X
if (iedom){
6 n+ }8 [" G; L* Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), w4 Y8 z: y: D) p0 W5 `! C$ [, H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' E* K8 ~  ?- ~6 _; ]* T  u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" c9 Z' c. ~' N$ Z' qwrite('</div>')) u( X2 y6 O/ S2 }. h( S
}
  u9 U0 |# Q; R5 z& _else if (document.layers){' y' S/ c# W4 t/ }- t6 |- s8 }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  Y) S+ r  b' x% ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. R/ h9 y- `1 r, n2 P+ s6 Zwrite('</ilayer>'). l: g: L7 [! D  f
}( {' y1 H4 G" V8 Q: D1 ^) a# f
document.write('</td></table>')! v5 l/ |; m" a5 ]' [: Z! o) B- c
}$ G' K* d- c% [; ^
}) c/ x& D7 J* q9 M4 v8 D. B
</script>

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