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

|
网页之跑马灯文字特效
//修改宽度" k/ N& K! i: S' e/ o
var marqueewidth=300. E" U [3 R8 p" z
//高度; c1 k! E. o" i0 ]
var marqueeheight=256 O1 {6 \5 X$ L. W6 P# v
//速度(1-10)
6 U8 S% I4 ?, Z) Z9 |- Bvar marqueespeed=3
0 ]" j+ x( D4 Z1 N//背景颜色
7 ]# l2 x s0 l4 o! r hvar marqueebgcolor="#FFFFFF"
" T: b4 w% l. D0 H$ ~: Y. Z4 t2 S+ V//是否能暂停 (0=no. 1=yes)?
0 X; K9 ?, T3 L' f9 i0 uvar pauseit=13 y2 m! Z2 I: {, x* n$ H: `
! ^% l1 D9 p I! R1 o, r, U' [$ Z//修改显示内容
5 ]" D* ^) p1 K0 D( X& K1 h" Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. W/ D7 O9 M { }
7 D1 f+ b# m0 {+ U. x* P% g7 x0 Z7 r. {% u$ R7 i$ a
////下面不需改变////////////& d+ N6 o X6 H
% s: i2 s6 r( c# y+ T' J% K; N
var copyspeed=marqueespeed( U+ G; E! j- y, l
var pausespeed=(pauseit==0)? copyspeed: 0
f" W4 L& Z5 Gvar iedom=document.all||document.getElementById) y6 ]9 R2 ^: {& W5 n+ [) Y
if (iedom)
+ u b% y9 u1 F5 tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 ?# M0 `' s+ J$ T$ U' t
var actualwidth=''
5 n/ J1 {4 D5 Y% t+ Q: G/ ]var cross_marquee, ns_marquee
! Z2 p' c1 m+ x4 [: P3 X2 P+ w I) }( t" I- W2 Q
function populate(){
4 h0 H0 R5 v& o e! sif (iedom){
2 y% G* ?1 x$ R. A4 n0 Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 K4 U' V0 b8 A6 N2 M' ?cross_marquee.style.left=marqueewidth+8
6 n) f5 V+ }: {" Pcross_marquee.innerHTML=marqueecontent, v3 |% d( h6 X) f* c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' Q' k! u( ^& V4 i5 i& f M}: K- D; |; r$ ^: @7 _8 {: C m/ Y* G' ]
else if (document.layers){3 _ X% C& y4 Y
ns_marquee=document.ns_marquee.document.ns_marquee28 {+ {# ?& Z1 ~. t
ns_marquee.left=marqueewidth+8- m- I. J% \& u* N
ns_marquee.document.write(marqueecontent) _) b9 X$ S0 y9 m7 [9 M
ns_marquee.document.close()
; \1 ^3 I5 L; W* k8 z( Bactualwidth=ns_marquee.document.width
B: X) q% j0 d! S; u, }}6 ^" U* n$ t" R6 T8 Z9 F+ I
lefttime=setInterval("scrollmarquee()",20)
/ m' K% ~/ \5 t/ N3 s}5 V* f2 M2 w1 Y4 I k
window.onload=populate
P# c" _4 X' ]% P2 u J
; p) Q+ @) s. L- Z( X) wfunction scrollmarquee(){6 l4 V* g, g" }1 ?
if (iedom){
* N! R- C8 x6 [5 P) Y; rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% X4 Z/ w' J- G- |# v' v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; n' ?7 w+ b! _$ V0 oelse
+ N) W( F S6 I, R' fcross_marquee.style.left=marqueewidth+8
% z& M+ P" u4 Z8 R0 J, X; d% D) r
}
. D& T; ~1 X8 i2 u6 \3 D: welse if (document.layers){
P4 ?, ?: \+ p: ]if (ns_marquee.left>(actualwidth*(-1)+8))
4 E3 p( t$ w; c! u& |+ `" pns_marquee.left-=copyspeed# o3 [1 `/ G- W* ^
else4 Q$ ^9 U( w' E$ o, w
ns_marquee.left=marqueewidth+82 \7 x& `! I) j
}4 F/ P" F) H0 Q. M$ D
}" @7 Q9 W" C: b9 K* R3 Q, _" ?3 b8 S8 }
% f( y1 B0 A2 v. V) Z5 u
if (iedom||document.layers){
7 T E6 s& j5 h+ X& a. a" s! C& ewith (document){
3 X, ]: E9 Q4 X4 g: [ Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 d3 C- [0 l$ _. nif (iedom){
- z% T' {# @) R* L8 Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 Z/ G8 N/ X. h2 X9 t5 ]5 X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- g: N i+ U' m4 R% w( w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& H& \6 ]5 _4 b6 Y" q, A
write('</div>')
- c; F6 z, F/ B) a/ }: Q6 Y% C}9 Y3 S+ R% }5 Y0 V
else if (document.layers){$ I+ o2 j/ k" Y% D
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- `" N# m1 p0 o/ J% Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# o* G$ w. a& J8 o2 {
write('</ilayer>')1 f+ J$ q/ v! [. n# F/ z
}* O0 a& a0 t& Y* ]' U
document.write('</td></table>')
* }6 X& g. k& q! S3 J+ D2 b2 ?/ J}
4 }# Y# a9 D7 X3 t}
5 {; i; w' j6 `9 P" U9 Y7 X" Z</script> |
|