|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
/ ]) J7 e) K1 I6 z; Evar marqueewidth=300
9 ~+ q {1 J$ j7 ]* G D: p) d" O//高度6 P& m" ?0 N9 E% @6 d. w: Q
var marqueeheight=25
5 n8 _. z& W" H5 C% c% V, R//速度(1-10)# K- G3 S9 r |" ]9 r" S: C1 k
var marqueespeed=33 A: X2 x& N: d7 Q2 o+ [
//背景颜色% ]8 U, V. P+ X2 [* S" {. X" C) Y
var marqueebgcolor="#FFFFFF"
; b# F" X) l u//是否能暂停 (0=no. 1=yes)?6 Y8 v) q( ~: e0 C3 C
var pauseit=12 @% w/ t- H7 b& b4 a6 V) n
2 ]' J4 Y, k- u2 U$ k9 u- g' v% b- I
//修改显示内容
9 z9 Q/ m; s! f2 l, vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 B( j( N: e9 H) N6 p
0 A! e' Y# Q& u7 S% x: b* d( t$ A
) U; m8 Y9 y8 R! v////下面不需改变////////////* ^1 l% E# s% L( r
% G4 `( `3 K3 @( P! Ovar copyspeed=marqueespeed; U& E' P" X$ Y, Y, n+ _; c* ^
var pausespeed=(pauseit==0)? copyspeed: 0% K L) d3 H# k2 q# ~
var iedom=document.all||document.getElementById0 ]* K0 [6 _- Y7 t" V4 t
if (iedom)
* b1 B" d# k Z3 c; _8 W. t' M# }9 Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- \7 Z; ]7 j; N( I. y" xvar actualwidth='') x: a" V& u6 d
var cross_marquee, ns_marquee
) _; ?3 A' j9 M$ w- |7 P
6 G4 g2 n! h* G' s2 Bfunction populate(){
: a4 Z7 r3 i7 xif (iedom){* F g# [* J- ], p# G5 v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ t. w v4 ]6 p. m3 ycross_marquee.style.left=marqueewidth+8- k4 m, a4 o5 z% w9 |4 V
cross_marquee.innerHTML=marqueecontent, K8 z% O' B) r" z+ t0 `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 M8 B( s1 p3 f& k+ L}4 Q' X- C. t7 J# L2 j+ c
else if (document.layers){
) h9 Z5 b2 ?2 {ns_marquee=document.ns_marquee.document.ns_marquee2, w9 G# f7 C7 y
ns_marquee.left=marqueewidth+8
; g/ X7 }( B- Q7 i+ S0 L9 gns_marquee.document.write(marqueecontent)
" j2 @* |. P ans_marquee.document.close()- ]" C% c9 N5 B2 ?
actualwidth=ns_marquee.document.width; a4 ~/ b9 k$ @- X) X7 O/ T
}
! M& ?5 c; K% ? C7 o8 `lefttime=setInterval("scrollmarquee()",20)/ c& G; q. A, b+ p
}
+ V' t5 M& [: ?% \5 ?- vwindow.onload=populate; O; Y4 ^. Y9 B+ |% `8 ?& F
# @$ D) e1 a3 ?2 Z9 ~
function scrollmarquee(){
3 W7 k' U, |, M8 |( c) yif (iedom){
5 }- p$ C; ]. u. c& ]- h7 aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 o/ M# N \8 _ p2 s+ Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; }( Q* B0 c/ J% u% V# ?else
, y% f8 a7 Q% k# Scross_marquee.style.left=marqueewidth+8) [- ^3 i1 z* f U
) ?* f/ U$ }9 k4 W* a" I5 H}, P1 t9 G8 t) d
else if (document.layers){" [; \9 ?" p P9 e) f7 I0 M
if (ns_marquee.left>(actualwidth*(-1)+8))
* f9 j" t: _5 ^+ C5 i3 W4 Sns_marquee.left-=copyspeed; z; \. O( _& P7 U
else8 _+ A; q; n$ |, [) h2 D
ns_marquee.left=marqueewidth+8
+ ^- o, O- ^0 x& g5 D, H1 h}! b. ]; ]! S x' R9 M& S4 S3 A& ]+ B7 H
}; z/ P) }8 B- D5 ^* q; J- b
/ \/ c2 s! ~+ k8 v8 ~+ O
if (iedom||document.layers){$ q- G& N# ~% `! o" `% |; C8 w4 Z
with (document){
! j( K# H1 g; G- L- B& F1 qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 F8 w/ |$ a: wif (iedom){
* i0 y1 w- I" D4 F/ k; Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 f& W& T, @$ ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# j: Y: ~. E" K! o* lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), o# ^) {+ J8 X ?
write('</div>')( P3 j$ C/ `" d; Z
}$ a1 [7 G k) Z2 ^1 h
else if (document.layers){) i3 g0 n* b E1 d4 \: k: k1 d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 j9 J9 K2 y) u& h5 ~) a6 a1 ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" H; b7 B3 w# y0 a6 M2 X e
write('</ilayer>')
0 m" S p( x8 Z2 o}
4 m$ ?- j I9 E2 u7 q9 sdocument.write('</td></table>')1 P( k0 [* _ v6 R
}
! X/ `8 [) h+ V: u9 X}
8 W3 R& [5 F9 W</script> |
|