返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! ^3 M, I7 P7 a' z+ Pvar marqueewidth=300" K8 c+ g; H( O4 t# P. ?6 d
//高度$ L$ W0 ?" X! s+ v
var marqueeheight=25; x% \- M1 h0 W9 M( `6 y$ e
//速度(1-10)6 E) E4 m+ w* i6 o4 S" ~
var marqueespeed=3
& W3 x0 A" g( N$ ~+ q* c# \9 X//背景颜色: t$ v+ x, g! d$ f8 s
var marqueebgcolor="#FFFFFF"* A  O4 Q- Q7 d# W, i- F% ^& T
//是否能暂停 (0=no. 1=yes)?
# U) t% T' v4 ^; ~var pauseit=1
% i( x( P- Z1 R' w! Z5 t3 x/ e1 a! T( L" a* a
//修改显示内容
' I- P- W) k$ `; pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& U  j6 x% p9 u: I8 h# v
9 M& n% e* o6 I! P
5 W4 }5 g1 R7 k5 Z* e
////下面不需改变////////////" p4 A: I. c8 g$ G# I" l  ^

1 L0 }4 Z2 F4 X4 E& Lvar copyspeed=marqueespeed, C6 J8 v3 k3 _: X
var pausespeed=(pauseit==0)? copyspeed: 0# H. I8 j* q7 n; x  m7 U9 ^, X
var iedom=document.all||document.getElementById3 t+ v$ s- `7 G- U: b
if (iedom)
. @" ]4 v( r6 ?1 f8 W3 \7 Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. `$ h. g1 t/ N8 Z" svar actualwidth=''
' l$ r7 J! t; n6 O, N* y% xvar cross_marquee, ns_marquee5 s1 H& p- D3 E7 k4 x
) \5 q9 e0 B) z0 a( U. e
function populate(){
3 R2 H- _. P* d# y" Z$ A2 Z+ l4 b$ fif (iedom){5 U1 p$ C1 l/ R  D+ q; F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, y$ F2 \/ h" G! `% B
cross_marquee.style.left=marqueewidth+8
+ c! {. K4 r6 A$ `cross_marquee.innerHTML=marqueecontent
; t3 `' n( a  A4 mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! }+ M3 j5 H- J$ B, u
}) M, L3 a9 m+ [1 {/ d
else if (document.layers){
3 B* [& z4 _6 a! c+ ans_marquee=document.ns_marquee.document.ns_marquee2. l9 m( v  N3 K+ n
ns_marquee.left=marqueewidth+8
* Q% P3 A) _0 I. h+ n* Hns_marquee.document.write(marqueecontent)
. ]# X6 j* Q9 e% G* T  Cns_marquee.document.close()
, W1 k" U1 ^0 w7 u5 Z/ A; {) e8 eactualwidth=ns_marquee.document.width7 n# Y6 _! ?5 ^& X$ }2 h
}/ S# h, L2 }/ {4 e! M
lefttime=setInterval("scrollmarquee()",20)
2 h. C, ^8 y7 I* P}
+ a) I3 l6 p0 }window.onload=populate  v' K  y0 @1 n6 ^

# k9 }8 M, S, M& O. N2 afunction scrollmarquee(){) S) a" h, h* E, l4 d; G. E
if (iedom){$ N, [8 @: D% Y5 ~+ ]; k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" K7 K9 |/ z, R# Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 R: H. M( Z/ [/ ]0 x2 ~( M) M
else
, B5 r3 Q8 x6 u' ccross_marquee.style.left=marqueewidth+8
. F# U( V$ c5 E7 i, y7 s' C
/ @7 ~- s0 j( z# E; {- K}
6 J% ?: y; T. u. f5 Oelse if (document.layers){
; C7 M" O* Z9 U( Q+ mif (ns_marquee.left>(actualwidth*(-1)+8))
8 w- ^  Q. s' d% L6 wns_marquee.left-=copyspeed
7 a, p  i& a! O  G3 L% Selse
) [5 L) b* d8 D: Z5 @) J& Nns_marquee.left=marqueewidth+8
) B* N8 _0 o! x, c" i/ k2 `) s}" a9 ?+ O" V8 Z+ b; I. z
}' Z+ f9 S, Y" ?0 c+ v: N+ _5 s% E* a
5 C" Q5 p5 Q$ q/ J
if (iedom||document.layers){
3 ^  }0 n2 y1 ^5 P8 h1 @with (document){9 k* `" |, b2 h$ t4 i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 H. i6 `+ ^) Eif (iedom){6 Q1 p! J9 H4 r& H/ [' v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ U8 O+ @" }' e6 y$ Q3 M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  ]! X- V' Q7 d9 b8 Y9 Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ y3 A7 m+ B8 X" Y. O
write('</div>')& O9 L; [1 W3 c/ D0 K$ N3 o$ l! T! V( p
}
) O' q" `& B" `( H. h) {% eelse if (document.layers){
' H& y4 d* l0 x, G. |3 Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# Z/ f$ L% O1 k9 z1 Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 ?; t/ y+ j/ H. B( ]6 pwrite('</ilayer>')
) {* E* ?# ?2 t. V7 v}$ G4 S+ v9 q% e2 |- X2 y' @- ?
document.write('</td></table>')
/ v" Y' z5 l" }/ D7 h8 U$ E}3 B: p" n7 ]. r, `+ z0 r* `; V
}' [' m. [! b4 v: \0 _
</script>

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