获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 M6 S( I, b6 T$ J, H5 K- L5 k
var marqueewidth=300; m. ]0 H, Z1 g- F
//高度
4 P9 Q1 D/ b5 S6 V: R' C5 q; l+ \var marqueeheight=258 L: a4 y$ o* M+ }5 L- I6 _
//速度(1-10)  O1 s- w( w( f- Z8 g( m0 y" q
var marqueespeed=3
' I4 J9 a& p, D, \- C//背景颜色
. x  V4 H% G9 ^8 V3 m" E1 Q% w1 Yvar marqueebgcolor="#FFFFFF"
& t' g7 A5 e% Q: a1 O//是否能暂停 (0=no. 1=yes)?
9 N  h. J$ a# ?$ bvar pauseit=1
3 ^3 ~& ^! {9 D- U) m+ M1 F
* _& n  k& B9 Z4 R# K& p* x1 e//修改显示内容
& v+ L9 r% B6 O- h3 jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( ~- ^% a  d1 X8 u1 r( T2 l- \  ~/ M9 {9 B8 J7 ^

2 y) G- m5 w: p2 D& ]////下面不需改变////////////
6 k  D0 Z1 J6 N* O
2 j# s) M$ b. u9 l5 Z8 g/ ~var copyspeed=marqueespeed+ m: f6 e. `$ M$ O
var pausespeed=(pauseit==0)? copyspeed: 0
; i# }3 g$ g3 e" V% ?! d: @var iedom=document.all||document.getElementById+ j3 h2 [/ Q- D& l- Q" u) E$ O; l
if (iedom)) f, ?+ z  f# g" j+ `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 Q8 _# ~5 v1 D! w/ Xvar actualwidth=''
* a3 c, P% E5 ^var cross_marquee, ns_marquee' ]* \3 [9 ^, P% V' X

% q' T. {+ G( k5 l. hfunction populate(){
  A7 t/ J5 V6 C# Hif (iedom){
" j2 T, i* G+ [5 ]1 scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ _0 K* t1 z! Y% u; f
cross_marquee.style.left=marqueewidth+8
) H. t; b1 o0 W, I6 x- E! qcross_marquee.innerHTML=marqueecontent
$ b& }, H" l' M  lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 {: }2 Z0 X" g1 e. S4 s! v
}
' R- X. K/ h3 v# N3 ~4 S, I- qelse if (document.layers){7 l" l  m. h- E! _; z& U- [
ns_marquee=document.ns_marquee.document.ns_marquee2
: a4 ]/ h( M7 _% M$ s/ f$ dns_marquee.left=marqueewidth+8
/ c7 M# V4 w4 N" j$ N2 qns_marquee.document.write(marqueecontent)9 V$ I" s8 h; R
ns_marquee.document.close()
# B% K% A) ~. z6 ~; ?actualwidth=ns_marquee.document.width
4 H" R' @2 K3 u2 E, K$ n}
* q7 r+ Y) f5 Xlefttime=setInterval("scrollmarquee()",20). `. F$ e* S# W2 K, I/ v
}
: Z2 T; \8 m- m9 u/ rwindow.onload=populate, d( @- a' e( w/ V- V' U# G

1 Q% i( c5 ?3 {0 r+ p' gfunction scrollmarquee(){
! ]9 B3 f$ h. j- Bif (iedom){6 s7 T( i+ l. e( t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 X/ [! a/ x( B' I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 ?* i0 `; U' o  a8 F+ _else4 Q" F* K0 j7 {/ n
cross_marquee.style.left=marqueewidth+8. p* ?. h4 K: w6 o/ D7 c

: Y5 b5 J. n7 K}
# q. }4 l, n% x$ B4 J6 |0 N6 oelse if (document.layers){
/ \  c: Y/ K$ }( y  a  J; H% Dif (ns_marquee.left>(actualwidth*(-1)+8))
, U; {9 J- u7 N$ ]% U: dns_marquee.left-=copyspeed
3 }/ a; Q+ M  _: U' Xelse
8 X; T& h7 C& p& R0 D/ V' Zns_marquee.left=marqueewidth+8
0 s6 \" l5 |: _9 {) I: T  {1 M}
& Y: X' p' ^4 S# b6 y}
( q; a2 g2 L4 G2 m& @1 ^) a: r3 C( i- x
if (iedom||document.layers){, ~. r% f! i& @: u: T" _0 X
with (document){
7 O5 B1 r3 T: Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 h' v  P4 e7 M2 [, t% _, iif (iedom){' k! z/ f9 X3 U6 R3 p8 J6 P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, n) C& o1 b* g1 t7 iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" j. t( ^8 V& U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 G2 i$ F, v& M5 z5 o1 s
write('</div>')
; l+ I8 r( R9 d$ {. ~, y}
- s: @- h9 U* ~. a& _else if (document.layers){5 y8 m& b8 I9 c* F) g" a; ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 K# O- r% L, u' ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 f4 {/ X; F1 E' i1 x+ m( s* l( Ywrite('</ilayer>'), ^" Y- ?0 A8 h! |' ~
}" P! y0 h. u5 B' J2 X* ]
document.write('</td></table>')
5 I1 ~0 x0 W7 Y}
+ s# H+ X$ i# k}
& q) x2 H9 w( E" o3 J</script>

返回列表
【捌玖网络】已经运行: