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

|
网页之跑马灯文字特效
//修改宽度) y5 }* x& \5 l. t2 P) M
var marqueewidth=3000 ]3 O( Y8 t) k. E- B0 W
//高度
# e' p9 c! z. \, ]- ? }* c9 nvar marqueeheight=25( ^. W, O- e4 k5 L% S
//速度(1-10)5 D9 m' K! a. f: ~1 P# x! O4 K
var marqueespeed=3
$ C7 y1 Q: b8 i1 ]( {//背景颜色- @$ {2 L; Z- S6 {+ }
var marqueebgcolor="#FFFFFF"
4 }6 n/ U/ ]/ Q5 j/ T//是否能暂停 (0=no. 1=yes)?
! q% \9 I( `( B( w! ~var pauseit=13 f0 Q7 M5 C6 L5 a# V. M
0 B* M6 {5 ?5 ^0 e5 p//修改显示内容
; N% v& y& Q9 t) Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', N, N3 _: H4 Q i0 Y8 Z; F' ?
S U8 t% j$ E; k6 f9 q" q
|3 J" I& d. k3 F+ a! a& d9 c
////下面不需改变////////////
; P* U0 e% e+ I- j! w5 ~; c( R @* a, w7 `- z- ?) L& F, }+ ?2 D* J
var copyspeed=marqueespeed4 G( J- Q3 J6 Z7 v
var pausespeed=(pauseit==0)? copyspeed: 0
: ~# L3 K" ~' j& X5 t0 Ovar iedom=document.all||document.getElementById$ e9 G6 b q3 O3 \
if (iedom)7 F3 T5 P. e. L0 M+ X: N/ r! f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* t+ j! M* w" ]5 A- |" v
var actualwidth=''6 m7 \0 L1 T( A# X- \& x& w2 U3 w
var cross_marquee, ns_marquee
2 }9 }# A7 z, }
* l9 a C4 G& Kfunction populate(){! V1 W! \ i% n" |5 c0 _
if (iedom){
& y2 F J! b. k+ l# ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ I+ K: O& b) ~
cross_marquee.style.left=marqueewidth+81 b* N1 k9 s1 {
cross_marquee.innerHTML=marqueecontent
) B* o: b% Q3 iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& C( ~ r" D+ n% |}$ U: e: U5 p3 l3 d! b
else if (document.layers){
5 o! |, ?4 g K4 h5 o( \0 s) pns_marquee=document.ns_marquee.document.ns_marquee2( [: I8 O0 f* @1 o
ns_marquee.left=marqueewidth+8
/ ^9 q9 T$ T1 H$ lns_marquee.document.write(marqueecontent)
: ^# N3 @, O2 X+ q0 b/ mns_marquee.document.close()
! I) Y; Q5 u, Mactualwidth=ns_marquee.document.width
4 A B' g! R1 O8 G} r5 i1 P! D& h% O& z. t
lefttime=setInterval("scrollmarquee()",20)5 H8 z6 z8 U7 N7 f% f7 b/ H+ c
}
g4 O/ v5 e6 m+ I Awindow.onload=populate# Z! c; a% P# {
}0 f" U" i7 O4 U% {function scrollmarquee(){
) }6 O ^4 @5 l# F9 d Y( U2 kif (iedom){! v+ r9 {3 {1 F/ t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), D& c8 W! q- e' Y6 Q8 U1 C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; w& Y( p& {5 p4 w; D% @/ L
else0 P/ f# o8 c2 n; a4 a% ~) [
cross_marquee.style.left=marqueewidth+8& S5 ]5 G. T% _8 \# g4 ~
9 z! Z( ~: I5 U* r8 r0 g8 a6 d
}& }# Z9 u$ b+ ]0 e9 y! e- W
else if (document.layers){
" o4 G0 i L1 L6 {6 ~if (ns_marquee.left>(actualwidth*(-1)+8))
4 c8 k' T- c5 w8 |, Pns_marquee.left-=copyspeed
( b% v) o6 H" S6 h$ helse1 l3 Z8 e! I9 C" E
ns_marquee.left=marqueewidth+8
7 @& O! R5 g* {! W0 y: g- }}
8 s1 a% }& c' r) q3 q) O& O}
5 ]* u5 |1 {4 h0 I( n
' j7 a$ T- W0 [$ vif (iedom||document.layers){
! A+ Y- x( o& t: v. ]6 awith (document){8 B! n( i! R3 G* d1 d- f+ t$ F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& p+ [& b& \) @" xif (iedom){
! g! ]. O3 l: s; \6 swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* r/ y& @% k( O* u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 ]2 j& R2 W, [9 G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 O1 ` O7 S! w- S$ ]0 k. K7 {& M+ Swrite('</div>')
- E8 ?+ ^# s9 w2 g}2 H- Y; d: W$ n# S4 r$ m( c9 P
else if (document.layers){3 ~8 u0 |4 E* m+ _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. y6 o4 d& Z$ U0 O! b0 O$ Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" B2 }) [- U: _& o
write('</ilayer>')
' v/ t p5 l9 d: j4 c}8 D r8 O( b; S3 l
document.write('</td></table>')2 w! i! v7 O2 O1 w- v
}
# P/ q' V9 N, }4 r}: Q5 L! l7 }% {1 s7 G1 H+ \
</script> |
|