返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ S# A1 \. e. Y% p8 t
var marqueewidth=300
& s& {+ D5 z' N( D$ b! ~9 {//高度
! w2 j4 X: x8 m  i* g9 evar marqueeheight=256 E9 @+ Z; k# n; r
//速度(1-10)/ Y0 d5 n" J  {3 D  h
var marqueespeed=3& J( Y1 e/ m% R# R8 y; e! G0 k: V
//背景颜色
, S+ X6 O8 m' @+ pvar marqueebgcolor="#FFFFFF"9 ~5 g( f( I. ^: w1 ^- n. l
//是否能暂停 (0=no. 1=yes)?$ O: a( }% P5 G4 z" u1 v" q3 W
var pauseit=1
+ z+ s' V5 p9 x0 t4 _$ C
5 e% h! ]0 R) X  u0 S$ r- p7 y//修改显示内容
" d! z& h0 |9 Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 p/ u# f8 c- b  l1 F: k. z2 R1 I4 X; `% U6 s! P

5 j7 E5 ^3 R) w8 K- o. U////下面不需改变////////////
" T% _+ h: y" q3 x; y
" `/ ~5 M5 d$ J: K: x. r7 Z: Y% mvar copyspeed=marqueespeed# z; y; w5 \* R/ T& ?/ b/ e  x
var pausespeed=(pauseit==0)? copyspeed: 0' j6 M# [8 m+ g0 d, M
var iedom=document.all||document.getElementById
  P! V" s3 Y6 R8 M: Y8 Bif (iedom)( q, O1 S, r2 \2 q! C. V% ?, W5 v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# A2 X1 ]* u) rvar actualwidth=''
3 P. W4 t7 j% `: W! Z9 f2 yvar cross_marquee, ns_marquee! M4 i: Z, d" v4 ]8 Y5 l+ K8 M

- Q/ k8 {) s: }- S0 I3 C- a5 Jfunction populate(){  F" k& C: b' W6 {; e- R( \
if (iedom){% W# r6 Q# p  z3 d1 ?- o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 N& _+ j/ o9 V
cross_marquee.style.left=marqueewidth+85 Z( ^& u4 q5 x4 y. [
cross_marquee.innerHTML=marqueecontent
9 n3 y+ }/ M! eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 f: H  b# ^( m: N) {) v
}
) `  \( K: e$ f$ velse if (document.layers){
4 t4 b6 }, @5 {  L8 J( ins_marquee=document.ns_marquee.document.ns_marquee2
. W' F1 ?0 W3 G- s0 P( e) Cns_marquee.left=marqueewidth+8
" ?  I: Q- R) E3 x  ~4 t# B- ^0 `ns_marquee.document.write(marqueecontent)$ M  I; I( _0 g  S/ |
ns_marquee.document.close()9 K. C8 o: k" L# s
actualwidth=ns_marquee.document.width
  g4 e& ^: W; b. l1 U}
+ P) Z% G* u+ B. H, {1 Plefttime=setInterval("scrollmarquee()",20)( ?0 O) t* L1 f, u4 `
}
: B' i- Z/ |& V, g0 H- O9 Swindow.onload=populate
3 t; e2 y6 @' Q" l, a, L4 h) L' n- R' j3 T
function scrollmarquee(){
9 J6 D8 D' [' F6 N! t# Aif (iedom){$ ~0 q9 r  y4 C) B% V2 D1 R& \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ }/ H1 K5 |, H; D; j: ~6 t& N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  m! w- S$ l3 H. u7 Q, O' \else
% Z* c, }& L; P; g2 Ccross_marquee.style.left=marqueewidth+8
+ I' |+ K9 A# n+ }; d( M+ q: p% c
( ?9 f: F' |5 f6 l}
1 U9 s% |2 X3 [+ b9 u, T  ^) qelse if (document.layers){
/ [: O$ K' v5 a8 L$ Wif (ns_marquee.left>(actualwidth*(-1)+8))
) ]+ D6 A# l4 q. U, uns_marquee.left-=copyspeed
) u% L7 W1 ?% jelse
8 ]4 o, s, A! i+ z4 ~6 p1 Z+ s+ w, Hns_marquee.left=marqueewidth+86 E" b1 A' s- |3 F7 ^& G6 E
}
6 X7 I$ V& {& Y, t}" V5 p* v- N8 Y& V2 Q0 Q
0 E* i" H6 {: s' f
if (iedom||document.layers){
* G# H3 r0 B) b( L8 C( rwith (document){
. `3 n' o( e6 ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): E) Y+ C; E: u% P& }
if (iedom){7 P( C, G' e( F/ ~7 q4 C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 g* \. K; F6 {4 {9 g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- u  [8 j# z, t. S; l" m* y" S/ e7 T+ V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' ^1 `" y! N1 `( h" Q
write('</div>')8 q# k$ Q  e7 e
}
4 |. w" ?6 a1 Pelse if (document.layers){1 ]$ z8 W" m/ d8 a- h# l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! H3 d- z6 o! l$ K, w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! Q' I/ h' R9 k4 R6 gwrite('</ilayer>')
& ^) X# u5 P+ q+ j}
* b9 N8 I4 }+ D6 Idocument.write('</td></table>')
) i* P' E( q: x- g}  H; y  p* r. B, ], V4 V* S8 e
}! g4 j" J* c( n2 q) ?5 ^
</script>

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