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

|
网页之跑马灯文字特效
//修改宽度
4 P" c% q* `, gvar marqueewidth=300" y0 A2 z7 s& J$ [$ B
//高度; D2 ?# k, h4 x, s
var marqueeheight=25
" E' P2 S4 i a# c//速度(1-10)0 O- U) {, R4 I3 T7 n
var marqueespeed=36 M$ `+ ?% a7 C: p
//背景颜色
9 T: u) x! ~& U! K) Zvar marqueebgcolor="#FFFFFF"6 A2 j! c& u7 s* y
//是否能暂停 (0=no. 1=yes)?+ X$ i5 ^$ {* A4 M& J
var pauseit=1
8 y4 e; V( M# V0 q, c4 n9 v+ K+ I
4 \% g6 H* |2 a8 S/ w6 t# @& s: A//修改显示内容
, g2 T$ n) r; p/ O, Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ b% J. @. w+ h
* x; y" G/ }) }8 O! c6 [! q6 P h! b. W
////下面不需改变////////////& R' f" Z) D9 L* L5 _6 z0 Y1 ~5 E
, s2 R- }: e- d6 Jvar copyspeed=marqueespeed3 U9 @ _9 Z, \# l9 ]$ r
var pausespeed=(pauseit==0)? copyspeed: 0
2 f8 ?9 \; E9 z g, vvar iedom=document.all||document.getElementById
0 A$ K$ Z4 D1 ]; j: l) A9 B' y1 v7 `if (iedom), j# O* Q* b2 z T4 ]5 ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). j& B+ v) j Z6 ]0 h9 |5 F2 Q3 Z
var actualwidth=''7 w6 g% N, P" z7 E, ]
var cross_marquee, ns_marquee1 n- k* y: Y6 n/ g
2 k, c2 C3 t5 G$ t, r6 @function populate(){
- S& w! {$ a" l( Z) h1 o0 D9 qif (iedom){
7 s% c4 }+ [$ j/ ^# z7 s3 across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* y, E% |+ H% Rcross_marquee.style.left=marqueewidth+89 Z; A6 n0 m; r- e) w
cross_marquee.innerHTML=marqueecontent2 K% o+ X6 I/ J/ ~& @. Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# h- g: C+ ^( _- P3 P9 t ?}
2 Z; }" v2 x. d; ^ }else if (document.layers){
( Y; B- P# c; v& A2 N2 Xns_marquee=document.ns_marquee.document.ns_marquee2
* S5 C3 D1 ^- N. Gns_marquee.left=marqueewidth+8
8 a( t2 X# H6 z4 L' i; s1 pns_marquee.document.write(marqueecontent)
* O' p+ x, V! p8 @ns_marquee.document.close()3 Y1 G$ ~) C7 _/ }
actualwidth=ns_marquee.document.width
$ c- b7 r. w, C f! l5 M% J}
P0 p9 X# j3 o) ]) J/ u: Ulefttime=setInterval("scrollmarquee()",20)- O7 V& s \$ I7 {* u
}
7 S$ d2 e" t" @, i% Q8 `window.onload=populate& d Z% s: A8 Q6 f; w, a" U
9 ? x8 ^4 E, ]' U! F
function scrollmarquee(){
( \1 u* n$ Z5 aif (iedom){% C4 N; j5 [$ g
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
\$ ~5 v( S: ?0 X! p' k0 ]" vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 e2 m$ b0 ~* ~& S5 X7 n+ Z# g
else
3 N: X/ @. ` I5 Ecross_marquee.style.left=marqueewidth+8! p7 k& D/ h4 r9 t9 R, o$ [8 u
; G0 c0 t! p9 D' U$ {, V
}
( D! z6 e# O3 N' i% ~) E& Pelse if (document.layers){
+ H) k, V* p& M* p0 ]2 H6 H4 z/ Jif (ns_marquee.left>(actualwidth*(-1)+8))
, x- A2 S+ ?' Hns_marquee.left-=copyspeed
& I7 L7 V" I* W' _1 yelse
3 y2 V3 u1 C p: |ns_marquee.left=marqueewidth+8/ E8 A: D4 i9 U J5 Q3 s7 z# P; M+ l
}- i0 E" T$ N; o8 J
}
+ \9 D4 p' ]9 Q! X- M/ u
: E- V, T: {* Hif (iedom||document.layers){/ \- a3 n9 M d- h8 F) ~. }+ K
with (document){
2 b, d' q4 f" r( _% Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* \. P$ {- e) ~
if (iedom){& R2 p* u8 t+ u5 ^4 w2 i( r6 A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 p. i3 y; f$ f" D0 H: Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# K8 _. U1 _5 }* m5 i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): _* S _( U. F0 W5 p, x* Y
write('</div>')
w/ B( f- b/ Z6 g& Z7 n- {9 D}/ a; g4 o& }4 Z* q
else if (document.layers){6 z- E; `. W5 p) t# ^# y1 p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 D0 P1 z. B e/ ~3 Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ J$ }8 x7 ]: M, M d( Lwrite('</ilayer>')- {" h9 z. J2 F# r- o
}7 e, h+ b; [/ Y$ O
document.write('</td></table>')4 X3 X4 l6 ^. `! w
}
/ g9 K$ p3 Y7 l" D7 ~& B# Y}
! Z+ `* f z( Q- h</script> |
|