返回列表 发帖

网页之跑马灯文字特效

//修改宽度; I6 K7 g/ }1 D6 t: V3 b
var marqueewidth=300
0 I4 L3 x$ M& o" @, L) _//高度8 Y3 Y$ X$ t6 G
var marqueeheight=254 A1 S7 f; a; d1 }: H( P1 M/ e' x
//速度(1-10)
! Q  a8 I  H9 M% r( jvar marqueespeed=3
8 b5 B. K, j9 _- Q+ r/ R1 ?% W- D//背景颜色
2 ~' x4 ]$ t2 avar marqueebgcolor="#FFFFFF". c, k) k, }5 M
//是否能暂停 (0=no. 1=yes)?
) y1 ^# |+ }+ I" Yvar pauseit=1
; L. m1 W: \) ^2 d7 G7 H3 E& y# @! E
! @+ n; ?% V4 R0 c# S//修改显示内容
+ \, g: F# M7 {3 Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 _/ z% t/ [: @  d. C7 o
, {5 C! t. O2 T2 }+ [

; O) l! U9 k' F- O) o////下面不需改变////////////0 Z! v8 h2 J; i0 r9 P

% K  q: T6 m0 v2 b* y' w" Jvar copyspeed=marqueespeed
% S: u8 h) U* p# i. L0 ?, Rvar pausespeed=(pauseit==0)? copyspeed: 0# Z. L3 W, K% _9 A1 L+ T& n
var iedom=document.all||document.getElementById" G' H: _% O( ?: K/ \- U/ A4 g& n. M
if (iedom)
- k! i. V" Y0 j; d8 w) ?  _2 Q# ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# M0 r: @) _# A) k* ?var actualwidth=''* v0 |* B+ g0 i! ]# s' Q" R
var cross_marquee, ns_marquee9 j& Q, }; R& _! }: h7 v. j
0 |4 `1 \. N# S
function populate(){( X. O$ S* w+ v6 t2 r3 q/ s2 `: \
if (iedom){
* R4 G0 E! R+ p' d# {) O5 Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. ?: B( |3 Q3 h. L: X, b, m- {0 l% xcross_marquee.style.left=marqueewidth+8, n) N5 V& j. D3 C% t
cross_marquee.innerHTML=marqueecontent
+ g. U5 F. h3 e" ^$ y$ zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" {8 h! \, f0 K8 V, e& a, H$ ^}1 K. h- {/ [1 N' Q4 H! c+ c
else if (document.layers){) k" {+ @6 u& l
ns_marquee=document.ns_marquee.document.ns_marquee2! G1 l1 ^+ Y- Y/ X7 B
ns_marquee.left=marqueewidth+8* K  Z0 S, h7 x3 c  _* N
ns_marquee.document.write(marqueecontent)9 x" c  F+ v8 y) y
ns_marquee.document.close()6 Y/ f; r  [9 G" L: y# ~
actualwidth=ns_marquee.document.width# s. v% G, m  y: R/ [5 b, k
}$ w1 d' D' E; ^. l+ s: y. v! Y
lefttime=setInterval("scrollmarquee()",20)
8 L7 _1 t2 |& @7 {  `}
# `' F7 ?" `5 B9 Mwindow.onload=populate
) |, I* C; Z* {" Z9 G/ k7 t
5 T! `' W& K; C) sfunction scrollmarquee(){8 B: N3 y8 `1 H: ?7 z3 X
if (iedom){
) W, S6 h9 K% g* ?2 ]) pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  a" p- b8 n5 t& E8 A0 `7 H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) ~9 J9 ^; {4 S( @$ O  U/ A6 Delse: |3 H" b0 X* \
cross_marquee.style.left=marqueewidth+8
; V4 C0 ]& W* B. P) D! W0 m6 k% g- p
}' W+ T$ O3 U$ B5 f* `2 q! D
else if (document.layers){( @& \" @3 y: ?% l
if (ns_marquee.left>(actualwidth*(-1)+8))- i! x9 g' _1 Q7 N, s7 s
ns_marquee.left-=copyspeed' e" K9 F: R; |3 b* r% X* Y' |
else
- z7 H6 u/ i, C3 Pns_marquee.left=marqueewidth+8
# J, `( a7 j9 e7 Z3 S, Z}+ H$ _! u* ~& V4 T& @
}
6 ^8 Z+ a1 ?0 e1 L! Y# r
6 J0 ]7 ?, u8 f5 z  i% L" }$ [4 Kif (iedom||document.layers){+ k/ W6 b0 t- S
with (document){. W3 e% S( y6 u% {* ?1 f, l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" E' C5 K$ k; }# A% Tif (iedom){
* U- L6 k  f% x& v0 j* Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" F7 y# j7 D4 F7 t9 P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ ]) Z9 T8 C& n7 R3 _7 B. F4 K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), Y- D$ B6 C$ S. G  o' k4 y& x0 s
write('</div>')
! I# m7 ~& @4 T! T}
" x: ^! k7 U+ s$ ^; Velse if (document.layers){, A3 s% G0 m. w" K( h) ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 w! p2 y, q. c7 `" h2 U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  p6 h6 ]: I7 Mwrite('</ilayer>')- b5 t, u# O4 V7 b" i
}# |% ~. k2 v5 j0 Z" w
document.write('</td></table>')/ K* C- s! h1 V" P7 t
}/ M# |' p/ j3 o0 s
}* a6 ~6 h; C) y) [5 T- V
</script>

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