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

|
网页之跑马灯文字特效
//修改宽度. I' w( A8 E% T
var marqueewidth=300; }+ q6 @; j& |% K5 K
//高度* V8 S; e7 v# o. ?: ^
var marqueeheight=256 m. A2 u' o, L* W2 N! [
//速度(1-10)" X: ?# p- h1 ~2 k) S' L/ n
var marqueespeed=3
F: z6 M. \9 y, \/ ~9 ?1 G//背景颜色
; h, q- c+ `# y% hvar marqueebgcolor="#FFFFFF"
" Y; A4 p, i9 A//是否能暂停 (0=no. 1=yes)?
/ M; A N% \: R4 J3 nvar pauseit=1+ u5 [/ Y$ y5 B' k0 V" _+ U
) H- E, q; G, t( e Q! n//修改显示内容
3 G/ j+ `# s) [0 n1 x3 Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( s! l/ T# H+ N/ _9 a: o$ e5 v9 u1 T
0 Y* L: r) j3 K D6 N4 L/ ^////下面不需改变////////////
: u2 r+ u3 Q0 m* ?: a8 v8 p) n
" e: C- q) w9 E1 k& Y7 p. kvar copyspeed=marqueespeed
' K- J5 W( T2 o& |3 Yvar pausespeed=(pauseit==0)? copyspeed: 0
1 }! X; e$ X3 D, \ _* Wvar iedom=document.all||document.getElementById
9 l) h) f# I6 j# ]3 Iif (iedom)8 y2 d V' q* Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 x0 C! c( l+ y7 Y/ hvar actualwidth=''
0 j' x2 C9 M- H- d" ^. }var cross_marquee, ns_marquee, }$ ^8 o) b- m$ Z8 o' I" K6 m
- T" c& b, J& k8 {function populate(){
- p# X* C/ v+ ?- x8 aif (iedom){
0 P' G+ x. }( y/ Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 Y5 E* p; C2 w: S8 r( e& Xcross_marquee.style.left=marqueewidth+8
2 R+ H( {; {2 D! Ucross_marquee.innerHTML=marqueecontent
$ W6 \7 M5 @$ N; i0 S9 m1 Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 t0 o0 L9 T/ E% q1 D7 O: t
}
7 E. f8 e) [6 u/ A A( e0 ]else if (document.layers){
: n8 u3 w8 @2 m0 c) [ns_marquee=document.ns_marquee.document.ns_marquee2
5 m7 `& E) N8 g9 j4 \7 E' h% ?ns_marquee.left=marqueewidth+8# m+ w! z' _) \0 R+ ]
ns_marquee.document.write(marqueecontent)5 M: R/ u% q) M5 e1 c4 P: k* [
ns_marquee.document.close()) H: g/ I3 B* @9 u7 ?0 `
actualwidth=ns_marquee.document.width, }) u/ L& ~8 t; ]& f' h
}5 y V+ c. O# Z- B& q
lefttime=setInterval("scrollmarquee()",20)' W/ H6 Y% { J7 h: y9 Y" E
}% Q/ Y$ ]6 Z, h* C8 Z$ L+ E
window.onload=populate) s/ V* s& q& A( b0 W; L
s: D. n2 N5 c! S i
function scrollmarquee(){
0 H5 }( X0 [! Hif (iedom){
' x% f3 H, ?) F' y/ R6 f9 }( X1 q; aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 Z' P# y8 i6 V2 F8 p4 y/ n! S$ J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 A$ j) R: k# M" ^, Q
else2 ]5 |) ~( ]: A9 a
cross_marquee.style.left=marqueewidth+8/ z& n# q, [+ I; u7 l; c( e# |' v
# M2 R) S& I; Z7 v! Z$ B}+ U, d8 N1 _/ P) m
else if (document.layers){
% M$ o, S# i7 cif (ns_marquee.left>(actualwidth*(-1)+8))
' w a) h s! {ns_marquee.left-=copyspeed
) `- H/ j' V3 n- \: uelse+ R: t$ i# Q" K: z
ns_marquee.left=marqueewidth+84 A7 x3 v! G5 }9 E9 j- z" H& h
}) e0 ~/ ?8 q: l8 j* C5 c
}5 }: y: u0 S& Y: Z- U% B
0 Q" i: s# ^1 T/ E1 l9 _' g
if (iedom||document.layers){
, I) Z$ b3 a, j6 h% j) ^with (document){
( [; D2 [2 @. {* o; ~0 pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! P" a; s/ I1 V1 G; P0 q' N: bif (iedom){9 f) X5 |, ]; p1 l9 N7 G0 W0 L
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 ~; f. m& p! K4 S. d3 Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* R( H0 |6 T; c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 b6 `, j7 p! j5 h; N& swrite('</div>')
- }/ m& U% O; A! R* J}+ E7 K9 f& s3 O2 r
else if (document.layers){* Y$ O' J$ `4 I# d& V2 w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# V; i8 I4 z- F) @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 _" w5 p7 t+ E9 Y# `# h' R, d
write('</ilayer>')- B+ N- k$ Y* U8 j# v, _* q& R
}4 x$ w1 @% l3 M
document.write('</td></table>')* i# ~: G% N; {; Y1 c4 f# A
}" d! p) c3 `. I4 ~. {, t
}
0 x" C' q0 E9 A# a, h</script> |
|