返回列表 发帖

网页之跑马灯文字特效

//修改宽度( h/ D8 F# G/ _; Z* _! m
var marqueewidth=300/ d( z: \: W2 K1 v4 a' q; u; I
//高度# e7 @" p" Q7 |, \, X7 T8 S7 N
var marqueeheight=25
; {1 w7 }. R! u: P. F/ F/ {//速度(1-10). W* k) u; {' Y2 ?4 P' t
var marqueespeed=3; T- _1 N- `; V/ e5 A) w) a9 t
//背景颜色+ V# j% C: n. P2 H" b4 J
var marqueebgcolor="#FFFFFF"% t0 t  J/ h+ B1 D; t  v* h
//是否能暂停 (0=no. 1=yes)?
) A6 Z  r2 o  m$ r4 r: evar pauseit=1
8 C8 A* H1 |# f# r& v% ]8 T
# E: B7 ]& A- K2 F1 _//修改显示内容; C5 n. f3 ]. u6 j  E5 M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: U: ?7 q. T) i6 |, c( D) H& G& d, v5 _6 t. `, N+ ?

& D& U  I) V) V; f% J( g/ K- `& L////下面不需改变////////////6 p4 {  G; }# y" r5 U
( c# Z8 y5 {5 F( X* f2 i
var copyspeed=marqueespeed) Q- E; y' S! ?7 i# q
var pausespeed=(pauseit==0)? copyspeed: 0
% ^' `# O, R, E! ^6 fvar iedom=document.all||document.getElementById
4 k# g0 J, B8 Y; e2 F: k1 Y; wif (iedom)9 P; |4 O# r1 `$ X; q7 A  m' d) f) E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 G( x6 K$ @- Q3 I3 m$ Uvar actualwidth=''* b) Y  r9 u. x* `
var cross_marquee, ns_marquee
7 |9 Y2 d7 b7 T: B; I+ n( Q! h  G! z3 y, r
function populate(){
9 y/ F" Z- e' ~- N, m: xif (iedom){( s( b" Q  E& I6 m1 C+ u. N# U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 e! T0 W- T) p4 A0 R& j8 gcross_marquee.style.left=marqueewidth+8! q" h. |  ^4 M/ E
cross_marquee.innerHTML=marqueecontent
/ E! r$ ^4 @" Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! U7 H- O( C" ^" A3 g}
  [( O, M8 X+ X5 J/ ^4 Nelse if (document.layers){
6 t7 g- _( L7 V) @9 u  Ens_marquee=document.ns_marquee.document.ns_marquee2* {6 {" k* G/ l
ns_marquee.left=marqueewidth+8
% o  y9 P, U& c2 M% W; T; wns_marquee.document.write(marqueecontent)
) Q# s  A$ E1 T4 h4 Jns_marquee.document.close()
; h+ H) u* ?8 k6 `3 W4 `8 ]actualwidth=ns_marquee.document.width8 G) d+ u6 X+ \1 C, D9 G5 t4 ~
}- ^0 y4 n; T$ v4 W/ B
lefttime=setInterval("scrollmarquee()",20)" L. \1 o2 E. ~5 B4 {# n
}
+ C: ]8 I# ?1 Y. n& Ewindow.onload=populate
) ?& Q# K8 r8 ]" p  v
9 Y2 E5 E9 Y& O, U3 m" Bfunction scrollmarquee(){
+ Y, f- ?/ ]/ Y7 f4 B& X% hif (iedom){
- d' _9 E1 i+ F6 qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 n, S  N& N9 L" W6 f2 S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 f, e. F: H7 p5 I3 {5 y$ b( y; Z* Belse6 K& `& G. P. x; i; A* g
cross_marquee.style.left=marqueewidth+8
; q  Q0 G# I7 t9 {$ T) K# ^/ ~2 x2 B6 l
}
1 n' e3 \3 p5 h! e5 N* c  v2 T0 f1 f% eelse if (document.layers){
5 C  `) S' t' x$ K; `' Z1 Zif (ns_marquee.left>(actualwidth*(-1)+8))  u! h' `* g$ @
ns_marquee.left-=copyspeed
, [' i1 ]+ w7 Helse6 F) V: A$ L7 W, f! y* N% Y
ns_marquee.left=marqueewidth+8/ F8 }  v$ k6 Y( m- J
}, s/ m8 v5 c7 _$ v0 g- w
}# G$ ^+ ^4 I4 e2 h5 b; w

) Z& |4 G  h( ^( q1 w( L% Q% |1 bif (iedom||document.layers){
7 v3 N; ~# w5 h8 N% awith (document){
% }! z; }6 X8 s5 edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ `4 B& u+ t1 j# G
if (iedom){! W/ l+ w* p2 \6 K- q2 r# t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 s) T- o8 U/ b4 r* u$ w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 n" O$ w$ c  G- j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 H% F, I3 c- a
write('</div>')$ f8 Q3 D3 c) Z% G6 f
}
# O# Z& }9 {/ M, m  U% ielse if (document.layers){( z! P/ E; ^5 u2 q4 Q: d0 j" I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( N# f: ~4 z  f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# Q/ `  V4 V" w) v
write('</ilayer>')
- m- B" I$ j# X  A}
: B' E) H4 Q4 @& ]' Q3 c) A, ldocument.write('</td></table>')4 V2 X: f+ O# O* H, e, W7 U
}
7 P* n+ E# ?. W' \5 O, P}3 `$ F2 B) D* a5 A4 n! N7 ^2 D- |3 K
</script>

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