返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: x: U; {7 B! A. T8 s% Kvar marqueewidth=300$ r1 y$ p. z" [' u+ I/ V# D! M
//高度0 u9 l7 w) \* x. G; t$ q! y
var marqueeheight=256 ]5 n7 A" A3 s# N8 |3 U, }1 K
//速度(1-10): j  F# H; ]6 Y2 x' E6 d
var marqueespeed=30 ~: i6 g) c* V) c# G
//背景颜色! e, {: j$ d, {0 v+ Y3 g) e+ O
var marqueebgcolor="#FFFFFF"
5 J1 ?9 d+ u$ H! G, E% }2 U//是否能暂停 (0=no. 1=yes)?
, j+ L9 @/ Q# o3 L$ mvar pauseit=10 b" `4 e: W+ F1 `  v5 [

/ A' N7 U6 B* W5 I3 e! d" l//修改显示内容9 q; a* P, }5 j% {6 r& U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 j% u5 e8 x4 s$ p
/ k8 E+ |4 Q( p+ V3 T) p2 N6 ]/ b. r) o
////下面不需改变////////////
  L9 Q+ l& y* n
6 j4 T9 H: {( U* d6 W) Y+ ~! Evar copyspeed=marqueespeed$ `$ R# y6 }/ x0 C# ]4 s
var pausespeed=(pauseit==0)? copyspeed: 0
' I: l5 c; i+ ^( _' D+ Cvar iedom=document.all||document.getElementById* l/ M) g1 a9 J8 |3 x4 ]2 n! s
if (iedom)) L- c/ k, V2 R. B: b+ g, C/ i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, M9 D7 @# t4 l3 @var actualwidth='': W" A- ^$ q: z2 S6 R. O+ f* c! b
var cross_marquee, ns_marquee6 J' w0 b6 ]0 i+ ?# E
" f2 V+ w- V/ S3 [( I" k
function populate(){
; o! R# y0 h* [  _if (iedom){
1 I+ H; A% ?* Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# m* N4 \! h5 N0 L. P0 H  N
cross_marquee.style.left=marqueewidth+8
' s, b  P! ?; Ycross_marquee.innerHTML=marqueecontent
* n* ^# f7 F( F+ g8 y8 Y8 F: }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" r! M0 @8 l+ {
}
2 L# w3 a3 N8 e+ R$ e$ aelse if (document.layers){
* m5 ]7 H) ~; l& Nns_marquee=document.ns_marquee.document.ns_marquee2
2 X; f0 u$ B% O. E1 u1 ons_marquee.left=marqueewidth+84 _' i' r) P+ l0 L: ~
ns_marquee.document.write(marqueecontent)2 r# q. x8 G3 ?
ns_marquee.document.close(), l# B+ H8 X7 w' Z
actualwidth=ns_marquee.document.width
1 P: v5 j4 J( b: L}
/ a3 Y1 s( \, P" W$ Blefttime=setInterval("scrollmarquee()",20)
0 B' ^, T6 y, l2 F# V}$ V* t6 y& i4 e8 ]- C- [9 i: B
window.onload=populate
4 u- p2 g: b2 v$ x: d; T: F" H0 i  D5 F) ~. Y5 J
function scrollmarquee(){
/ A5 X7 Z/ Z: M0 ^! Kif (iedom){7 }6 i2 |5 V$ [. P. o
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 h, i: K9 U" i: Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 N$ N* \% l0 w- E5 felse
5 f) W+ w! B& w' wcross_marquee.style.left=marqueewidth+8+ X/ T, O+ ^" M8 `* |! V7 ]5 h

$ B, H; |; T1 h/ p7 R}
2 ~' F% Q) x; e& q( E: delse if (document.layers){) y/ T3 y0 o: Y2 y1 s3 f% T
if (ns_marquee.left>(actualwidth*(-1)+8))
& q7 l' J( v2 m: n$ P. |ns_marquee.left-=copyspeed
7 @, ?( Q" k5 t$ c3 ~( D* Oelse4 q! j) Y! e( \6 p/ I  L$ P4 U
ns_marquee.left=marqueewidth+8
- H( u( g- v- ?2 M* P, b+ j}
! ^; l# ?* r$ e9 z" @}
2 A3 g. a( i/ q( G+ e3 Z4 F& a) h( H9 h
if (iedom||document.layers){
& R' S( R$ k- jwith (document){
: S7 h$ G0 D8 T+ j( _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) D: e& L, @/ @7 D% L2 M
if (iedom){/ r& f1 @; G1 ?& H. Q4 O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 W: G" a* p5 U+ s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  S% ^4 S  Y  {' I" n5 d) C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- Q; V, L; y4 f: X1 {5 k8 O( ?" ]0 e
write('</div>')
; ~/ U3 |5 \$ \, ]( E# Z8 F8 N+ T}
& I$ i7 B( b5 l( A: f2 R) `else if (document.layers){1 a$ l" N% ]: B$ y: L2 A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 U0 w1 J( W# Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 [' A$ ?1 v& h8 }7 R( Zwrite('</ilayer>')
! ^8 W* W: d* d9 {}( \( c! X1 B) W& V* D& @
document.write('</td></table>')" d: e4 C; |! z3 S2 M, N4 {8 o& m
}# a! i/ Z# D6 m3 n9 W0 w% t
}1 {8 g) K3 W# Z7 g$ z0 |8 |
</script>

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