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

|
网页之跑马灯文字特效
//修改宽度' U7 F3 ?3 n* n. e8 \& }* Q9 }
var marqueewidth=300
. h: x) c0 E) h3 R//高度
1 q0 v+ K Z" ?- R6 A- S) X1 Ivar marqueeheight=25( `0 U* \8 D. l S7 {8 c3 ^
//速度(1-10)
! { o( J) M$ Z. K- Fvar marqueespeed=31 L: V3 j/ k: c+ ?. ]9 K& s z3 S
//背景颜色
. j+ @2 q- W/ ~' T% m: ^var marqueebgcolor="#FFFFFF"- J! K8 P/ X- F e( b5 _! ~4 t) ^% X
//是否能暂停 (0=no. 1=yes)?
8 H0 B* n4 E/ b: v* Ivar pauseit=1
; a: G. h1 }1 A) Z @. i& C B8 A& f) u" ~! M; z$ R# ]" ~
//修改显示内容
4 F8 g1 C! m- I& svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 E2 o) f6 p5 ^5 {4 o
, z0 t, T% Z2 B7 X3 N T9 T
, k" N7 O& k) S5 ^: x" M q: l" H////下面不需改变////////////
- H$ B8 l3 M7 W& v- z+ G& L$ x4 q% X. ]- C2 s! Y
var copyspeed=marqueespeed9 E, P+ u& J# W+ q
var pausespeed=(pauseit==0)? copyspeed: 0
_+ y* v% q* a* e Pvar iedom=document.all||document.getElementById
& U5 a1 W6 n7 Q) c1 f( v* [* tif (iedom)& [' H. w& I5 o, s! G5 y7 K3 Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% {2 g8 b: i: L: q+ Z' P# }
var actualwidth=''
. @; p/ j }' ^- A6 t4 Vvar cross_marquee, ns_marquee* d t O+ \; P a4 V( J
8 G, R: k l- Q+ f, _% Z `' E* Mfunction populate(){
& w& `3 Z; F- `if (iedom){
2 e5 @' a0 d7 O$ }+ @' I" e. Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 b- W( S! @, T5 Rcross_marquee.style.left=marqueewidth+8$ o& \' I4 M: x" z% g3 m0 r J
cross_marquee.innerHTML=marqueecontent% d& Z$ T, O7 a. V3 B. Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) d3 Y; S6 k; A- ?
}. N1 E3 Q) Y& J$ e8 y5 B- w
else if (document.layers){
" p2 r- K4 `6 v4 j5 l& tns_marquee=document.ns_marquee.document.ns_marquee2
: g9 d2 i+ a/ R: Lns_marquee.left=marqueewidth+8
7 W. U3 ~/ z8 fns_marquee.document.write(marqueecontent)) O% {0 |( p; F
ns_marquee.document.close()0 T! B, |( j* j8 ~4 c, c
actualwidth=ns_marquee.document.width X! [3 H) R! M- _! B1 p
}; i5 v) p" B* R; n
lefttime=setInterval("scrollmarquee()",20)
/ X+ \) | q5 m/ ~}0 ?- r3 p8 a# F2 i1 U
window.onload=populate, ~: w" X v# L
* B& m* ^9 |, K8 P& g- ~function scrollmarquee(){0 a" @# c6 z2 y3 c
if (iedom){4 [) f- x2 V( {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) w6 D8 C8 g3 Icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 e" r) Y% _' M3 W- b- r
else6 H+ [* l, I' I; z$ Q. \. Y
cross_marquee.style.left=marqueewidth+89 {' I$ u2 K* U2 e9 C" X6 s
c. {2 t, L0 n' `$ N' K
}9 [3 S' w, x1 _2 m8 s' o. b3 }
else if (document.layers){0 p+ q4 T# P! m+ Q/ Y# g6 t+ i' k
if (ns_marquee.left>(actualwidth*(-1)+8))
7 G4 B1 z; l" ?ns_marquee.left-=copyspeed
0 N/ f8 ]/ q! n% b+ [else! J. T6 ~7 D- `4 S- W
ns_marquee.left=marqueewidth+8
, F9 c1 ~/ i* g. U" C}
- N; w; }' s8 t* t}0 n8 a: J0 @" K# A4 C' ^
' i1 K1 Z& Q8 g) G- Aif (iedom||document.layers){
% J% k3 L2 u" swith (document){
/ n- f2 C7 y" h/ _! idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 B& Q! u9 l1 O( |: oif (iedom){5 [+ I0 V6 ^: Z% O5 u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ f' ^7 K( E } M8 w Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ U$ U/ e$ Q4 h# f2 K& n G6 U+ A! {5 Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 w. r8 }9 N- c. u. V) C% n+ Wwrite('</div>')9 V% g9 T' [* G$ Q
}) c9 Y( E3 \/ o! Y3 O# I9 C
else if (document.layers){0 } i( L- z9 V+ k* Z1 @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 U0 n. j2 w: u% P) R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! E2 |- t) v5 W0 u
write('</ilayer>')* @1 \8 f/ x4 r# B
}
4 w! ?! F2 P) ^7 H& h1 Odocument.write('</td></table>')/ Z' P: c |' D% B3 ?+ N8 J4 a
}
W; D n( n' I+ Q* C: \' ^- u}
# R/ H3 L2 y; r* ^</script> |
|