返回列表 发帖

网页之跑马灯文字特效

//修改宽度% P/ ^" S3 [6 \7 ~5 ^! m
var marqueewidth=3004 m! Q( C8 H: s8 m2 F4 o/ y. n
//高度, R6 `: q  D5 `- n; R8 V! Y
var marqueeheight=259 A  H, G; g* c0 T2 j/ y
//速度(1-10)) ]8 }5 C" x) N  M; n& {
var marqueespeed=3* N( q, y  g9 |: B4 ]
//背景颜色
, `+ H$ P0 Y7 G! qvar marqueebgcolor="#FFFFFF"
5 E/ L. z8 P9 u( ?9 c//是否能暂停 (0=no. 1=yes)?
3 D1 Y0 l0 {. P, }$ v7 gvar pauseit=1$ Z2 D$ ?/ o% S; R

9 C$ h% E1 m* ~//修改显示内容
5 f& R; r: h( G) C' W( ?0 Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# t3 R5 Q5 q2 `0 g5 O$ Y% n$ H& |& Y

! i/ Z7 z' {1 w0 Y7 T8 Z////下面不需改变////////////
. s& o# h, h0 G. q
, e' j* T* K5 f, uvar copyspeed=marqueespeed
8 Q+ q; O5 M+ ]4 D" evar pausespeed=(pauseit==0)? copyspeed: 0$ Y/ y+ q; ]# c. l% a+ I' I3 k
var iedom=document.all||document.getElementById/ s! {: ]  I' U* F
if (iedom)
: y: x& U" w& K2 U9 H5 Z: adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 t9 }- L$ z/ P- {3 M9 q# i" J# b- F
var actualwidth=''+ M2 O0 N8 j/ ~, o, k+ S
var cross_marquee, ns_marquee
  J( G; l- }8 }% _
/ h7 \+ _1 m3 g3 q; E& A3 zfunction populate(){
3 B, r0 r: h; l3 O+ f% Tif (iedom){7 U+ R: \1 {2 X  Q( b% A' [" I5 }! M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ |  j; W! W5 ]( b% D+ Qcross_marquee.style.left=marqueewidth+8
# _0 z8 C" M+ e3 T- G% I( G/ Tcross_marquee.innerHTML=marqueecontent
1 I! C" e8 o4 Q0 R* E8 {2 V/ sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' ~5 p, M7 h+ d, V
}
3 D. [  O: t4 V! }+ L3 }7 f2 [else if (document.layers){
3 j3 G& u) h6 X: vns_marquee=document.ns_marquee.document.ns_marquee26 U9 y$ x- n) L) R
ns_marquee.left=marqueewidth+8
# Y4 Y1 B7 B  H/ [- h" f8 u8 _ns_marquee.document.write(marqueecontent)
1 b5 X! M) `$ Y- I- q) Qns_marquee.document.close()* O6 Q! \4 R! ?' J
actualwidth=ns_marquee.document.width; s4 b% Y/ k, _! G: D9 g+ A
}
  ^1 E9 A" r  u4 p2 C0 }/ V( f; blefttime=setInterval("scrollmarquee()",20)
% ], a: a( j  q8 M+ C1 b9 L}
& O/ A# ^0 z5 k; D: i% ~9 Vwindow.onload=populate
; p1 A$ b7 _3 E4 C/ t/ q  j0 |/ G% }2 b4 Z! c: `1 V6 {2 b
function scrollmarquee(){- @4 C4 v1 ]+ b$ G
if (iedom){5 o7 G% l$ ?4 Y$ N) F, z: S2 W( L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) |/ {: ]9 B5 l% Z8 [7 _! Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 K' R! Y8 O/ @( e# @
else
# l( g( g& V+ H) Z+ x" S) rcross_marquee.style.left=marqueewidth+8; V9 w* y7 @1 N0 v$ D

7 z9 @0 E0 n' S5 k" u: g}1 d$ |0 H: W" j: ]1 X4 p
else if (document.layers){$ f" C8 g8 Z  R9 x
if (ns_marquee.left>(actualwidth*(-1)+8))0 C+ K3 e. _" [' d
ns_marquee.left-=copyspeed
% }) s4 p/ c& P5 V; S  telse) X- P& t- D2 n1 S# a: |! Z$ b
ns_marquee.left=marqueewidth+83 ?. S- A  H0 Y' V5 Q0 @# X
}0 j5 |4 z3 _/ H+ k
}
5 ~0 |( z& v, U2 j% y6 C& W0 c# o) r& U
if (iedom||document.layers){3 e1 Q: t3 x0 D5 J( l& Y( M5 f
with (document){+ P4 u$ n# q1 i" ?8 j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 O2 H( l8 i" l( [# |2 e9 @
if (iedom){6 p+ p6 j$ K7 b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ \. |" V8 [% X8 v) M9 x. r$ [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. V: d, I/ J+ H1 s/ ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 X; L/ d: e, Q) B, ]write('</div>')3 Z% z. N/ j: j- d! ?, b
}
8 O/ I; L2 |- J! f" {4 velse if (document.layers){
) G& l9 P! g3 Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! P: o5 R3 B% r8 ~1 Q2 i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; ?- {2 W8 W; x- t* X8 f# kwrite('</ilayer>')
% D2 D, D- c& M+ s* c6 Q}
* l9 y" B4 K9 F6 ^' c3 zdocument.write('</td></table>')
% j. U  x" Z. v3 H4 Y6 V7 [# [}
1 k5 l! d: s( |! ?4 f9 n0 z}2 ?0 D1 Y2 L6 E9 Y/ k
</script>

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