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

网页之跑马灯文字特效

//修改宽度
; N2 l% L3 g, V0 J9 r9 [3 C4 hvar marqueewidth=300
3 G* y: x2 T, k0 T# y//高度
) H" @& m( H+ Q1 S/ j* ~var marqueeheight=25
1 K, ~) j4 P2 w  e) J1 ^; r//速度(1-10)
/ i( S5 u$ ?4 B6 b# p8 k% ~var marqueespeed=37 Y0 x1 p( A, z9 s5 T; J0 ?) c9 ]
//背景颜色  O9 z  D3 Z  ?6 d9 t" p6 B
var marqueebgcolor="#FFFFFF"
3 m6 p, x3 ], g& e) N//是否能暂停 (0=no. 1=yes)?
( a, X0 N/ b4 V: U4 l( F1 Zvar pauseit=13 B0 b0 c; X5 ~. d! g

0 b+ t: u& B4 n9 V6 F- N! M' @//修改显示内容* E+ s; _8 J2 h; `2 B5 b  n, W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* b2 ~: [1 m+ y
3 t9 ?! C9 b( j9 f/ ~# R
  q' W* f. H/ s////下面不需改变////////////+ g3 V: A1 P2 j! k' E$ V7 ^

! H% ]7 x; `8 j: G  S2 Xvar copyspeed=marqueespeed
' B- p! T0 d; O# d! X& x, pvar pausespeed=(pauseit==0)? copyspeed: 0
* W" t) P8 y+ V; p5 `. w0 svar iedom=document.all||document.getElementById
( R7 t2 V6 q8 W; g4 oif (iedom)
/ ?2 D( A6 O9 F8 Q$ w! Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ A6 _  F4 Z+ X1 P! @0 D& \
var actualwidth=''
( T3 V" S6 _) e+ A# z5 |: Cvar cross_marquee, ns_marquee
$ C! ]( k8 l, u! n" v- b$ ~$ `1 u/ R( T' }& S' |0 r
function populate(){1 B( F- l# O" y8 t5 t4 h" o
if (iedom){( @8 t1 k8 S. v0 q8 C! p
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; D9 b/ ~/ o1 \/ Q: |9 z! M
cross_marquee.style.left=marqueewidth+8
+ d: t- C1 ~8 m$ f2 ?cross_marquee.innerHTML=marqueecontent6 `1 \- H7 [! Z/ O! ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, z/ G# n' ~* J4 k+ L% f- ]4 A}
$ Y. j8 \8 k" }6 }9 \6 Eelse if (document.layers){% S2 F! q: P+ l3 k4 b. y: d
ns_marquee=document.ns_marquee.document.ns_marquee2
, I# ]$ U5 H; f  y6 Q8 o: ^ns_marquee.left=marqueewidth+8! q7 B) S2 a) ?" @6 T* F, M
ns_marquee.document.write(marqueecontent)
7 b& u, `1 F. j/ d. L% Dns_marquee.document.close()+ i! h6 |, N( l! |% z) u& B
actualwidth=ns_marquee.document.width
1 b# d; h8 Y0 K- [3 P}( R  O' g. h' a& K! h! c, e
lefttime=setInterval("scrollmarquee()",20)
  g" V, S- N! t}
9 f4 I1 M8 B! j4 e( Vwindow.onload=populate% Y, S0 O6 l' [3 u* m

" l6 d; a3 A+ \0 W$ h: |function scrollmarquee(){
; f2 t& M$ Q* h3 W$ V) _if (iedom){
0 |5 C; s6 x2 I3 v/ \6 b" }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! R4 A' ?- e. R2 Z+ l- R( s% \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' j0 K% L! e6 p# X, u, R! f
else4 y5 M: K* d$ \6 F3 B) W. r
cross_marquee.style.left=marqueewidth+8
  A5 I  j: q7 e  r
3 `2 P4 f4 U" W, T# X; \! G5 t* J}
0 i( T# C& f( i0 Z& s: Ielse if (document.layers){
" T1 }+ s( Z2 t) d# W7 }8 m9 w: wif (ns_marquee.left>(actualwidth*(-1)+8))
4 V9 @; p6 \: m/ t& n6 S8 Nns_marquee.left-=copyspeed
' [$ B% ]6 T. ?else
: q/ C0 J" f$ V( J6 m( g' k+ ^ns_marquee.left=marqueewidth+8- ?: h' f$ m& l, \8 g
}8 H2 r& }+ J7 g/ ?3 ?
}
" {! W1 E2 J% w6 z  k
- t1 k! m3 O1 }1 x2 f& ^if (iedom||document.layers){
$ K4 ]1 F! ^* i7 t. Q" W8 ewith (document){5 g' P! ]  w' b6 z4 u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): q+ h6 w1 ~& b9 H8 G/ Q* c
if (iedom){
& p$ v, h2 y, Z+ J: o. q& Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. ~& \. X& F# Y, N% y0 nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 V/ c+ R3 K7 u+ v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ c5 Z7 o6 N( e9 h8 a
write('</div>')
! E! F) C7 Q. I$ \}
. [0 n. k( M% L3 J! `: H% N8 ?9 ]else if (document.layers){9 `, g; s( [/ y1 u1 U1 ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: d: u3 k5 B2 \% W, Q/ g, l7 Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 \, {+ c$ x1 v) Q( }$ ?
write('</ilayer>')
, A! P, N3 g# f1 U. K6 c0 e; W5 f}  V1 H3 _9 q1 k* F- G8 `( H% r
document.write('</td></table>')% |; q- i) u9 s" ?3 ?
}
9 u2 Q3 h3 H: {3 F7 E4 s' J}' z; ^$ ]- N( G. m
</script>

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