返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ V& C0 Z  J% `! r# ]# [9 Pvar marqueewidth=300
9 K- I$ Q8 L# {//高度
8 p$ Q% H* B3 c( P( x) P; l' [var marqueeheight=25; g% ?, v# @$ \: X
//速度(1-10)
5 u* l5 V; Q  t3 S4 G; Wvar marqueespeed=3
. U2 E& E7 s" I% i//背景颜色
6 K0 f6 J. f9 S( J! |! B8 Bvar marqueebgcolor="#FFFFFF"
& w0 Z! @7 c$ P8 y& F//是否能暂停 (0=no. 1=yes)?" ^" b! ?: |" h1 w
var pauseit=1
: W) ~* \) R9 Y7 L  ~
: t* [7 A+ k. h6 H% w4 N3 p0 g//修改显示内容: o! q0 T( ^# e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 `" }5 ]$ [3 r! y
" I: p4 t- T0 f5 l1 w; H. F
5 z+ ]% k) x/ b( j7 a
////下面不需改变////////////
5 u* n( N, g+ t% ]9 d' }6 e2 b# K3 l- ^5 s0 I9 U! e% g( q4 v/ T9 d
var copyspeed=marqueespeed
0 R: F% {1 M" _& p. [var pausespeed=(pauseit==0)? copyspeed: 0
4 \3 @) P  _2 \7 V  M; q7 lvar iedom=document.all||document.getElementById
( q% e- d4 M; k6 ]7 I4 aif (iedom)1 ~. S/ ?0 H) M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). @; a6 D. B9 {9 h
var actualwidth=''
$ K: G$ G; T; h( }  d/ t' k' ]var cross_marquee, ns_marquee
7 ~1 r7 V. @) g7 f5 K7 }
3 b. h$ C3 \, o4 a  l" Qfunction populate(){
( W0 \3 j! S  r: h' e: @if (iedom){8 U6 H5 q/ C" _# Y0 f3 M0 [( o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 j2 C% r* z& g- K3 e
cross_marquee.style.left=marqueewidth+8
- n. V0 U! s% x) a- u6 {cross_marquee.innerHTML=marqueecontent' i9 k+ ~! z2 I2 N7 A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' M/ ~% v0 I. I1 L& A) F}; R* q4 @" _5 m. \5 Y
else if (document.layers){
- G; d4 v  Q& ^ns_marquee=document.ns_marquee.document.ns_marquee2, D4 Y- d6 K; ]5 F7 z4 U0 B8 E
ns_marquee.left=marqueewidth+8
- C# U: z* B6 m- z% yns_marquee.document.write(marqueecontent)
; S  \: d; G2 q& P/ m/ Fns_marquee.document.close()
& K) B' e1 V. `% `" Iactualwidth=ns_marquee.document.width
4 m- w  ]; E' m  \1 y: U, _}
( S) n3 p/ b2 `, m; l0 xlefttime=setInterval("scrollmarquee()",20)
, A$ Q& v8 }; j; {/ Z" a2 T}! T5 V& q, A) E
window.onload=populate
9 S+ n# [+ _+ V
& |' l* o" P6 Y5 ]- m" Rfunction scrollmarquee(){
1 n- U" o5 i% ~. K0 Lif (iedom){
4 D. e' f: m# d9 y5 |) wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 |. w8 M/ `8 K4 b' z& icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 ]: Q) |1 x; Y# T- D+ Nelse
2 s7 Y  i. q' h  Z7 ?' Lcross_marquee.style.left=marqueewidth+8
2 T6 M* S* m9 S& n4 a
9 ]. }3 L& t) a' `4 I}
% g% W+ `# l# H8 ]else if (document.layers){
$ S' z5 V2 s) E) e, U5 y( bif (ns_marquee.left>(actualwidth*(-1)+8))8 l/ r% D: [8 u4 ]
ns_marquee.left-=copyspeed
7 M  C9 Z, y9 _3 c! {else
% P% j/ F- @1 ]  F  K0 @  k* Y! J, tns_marquee.left=marqueewidth+80 H8 [4 q& \+ r2 _/ {
}2 h" l, A7 {" Y* i/ ]1 q: A
}
8 f3 `# y9 @. b
# K. H: H" S" S8 w  Q/ kif (iedom||document.layers){# X* |+ P. h  K# M- l2 s
with (document){+ h  s/ a, r8 `' @4 n3 g: L9 v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( C) q  @) F+ H' Z# p
if (iedom){
8 O) p0 i; ]# ?6 `$ dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% n3 B/ T  T& U: o/ fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ H1 ^* ?& o: a6 rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( D/ A9 Q* r+ J8 J9 M& M6 ~: Ewrite('</div>')
8 Y' g7 J" `, g) P}
  U! E3 n+ A; J" v$ ~else if (document.layers){* r; g5 Z8 ~9 R+ o* }4 X0 g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, d* P) }$ X/ t8 ?% \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ M/ M5 l% G' R, G6 s
write('</ilayer>')4 ?! {% q0 U" s% @
}
+ y* P# @! w" e; G: J8 ndocument.write('</td></table>')9 X6 k9 [# G8 S: S% O0 U3 `
}
4 L9 \  G4 P0 n, b9 z$ M}
0 W; z, f% ^: S0 n0 v( G</script>

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