返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 Y4 c* L  U$ u- F2 `# cvar marqueewidth=300: V2 d3 d( I; N8 D& B4 B) A1 ^
//高度. `5 w! h& W3 L8 L
var marqueeheight=250 R9 e; N/ d6 e) Q1 |5 f
//速度(1-10)
4 I+ K8 }: I  \var marqueespeed=3, q6 ^4 s4 A4 [. c
//背景颜色& j/ V: ^# _, Y
var marqueebgcolor="#FFFFFF"
. A' g0 T* r6 b//是否能暂停 (0=no. 1=yes)?
8 N! w4 R% b6 M" ]3 _9 E1 n: Y( zvar pauseit=14 l8 |  U0 M) [! \3 s( D1 X

8 h" k* O. m6 v4 m, q//修改显示内容0 X: H% h3 U8 _4 `7 {/ \% ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; l1 r! B1 g7 _7 l  g+ F; Y
: n4 h. M$ u+ S5 e8 b; s
- x; k0 M/ \" w; l$ ?- ~! A
////下面不需改变////////////
6 r( I( c" r* ]0 Y" E( V$ X8 X: P- c" ]/ b0 O1 A' N  Z7 F9 o; s
var copyspeed=marqueespeed
% ^. r9 g0 y$ A' @1 j$ Tvar pausespeed=(pauseit==0)? copyspeed: 0
% H7 G6 T% e6 I; U7 U+ ?1 pvar iedom=document.all||document.getElementById
- N! f$ ~, e5 j( P+ |1 F/ y9 Fif (iedom)1 b0 n, j6 R2 T1 n/ M* {. g& u# J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* d! ]2 x" U+ C2 |  j$ S6 ~
var actualwidth=''3 A7 M$ x0 X# V* n% p7 r
var cross_marquee, ns_marquee
+ F; z  Z' T% `: H. a6 i
/ ^) C- y. s& T+ ifunction populate(){
. b' j  g( U# J' i3 o7 g7 [if (iedom){
& N0 L5 t- S% n( ^1 ~" Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 b* V5 }/ v) F% d' a9 _cross_marquee.style.left=marqueewidth+8
2 L1 f( x* J/ H$ ocross_marquee.innerHTML=marqueecontent" |+ J2 s" q& f& N6 j  i$ M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  O3 |3 u4 }/ j9 D6 c- @' q: t# M% y}
$ h5 |# L3 z1 f5 r. V$ [else if (document.layers){
# P, f$ N) v/ S( p' l4 ~# f5 j4 }9 Xns_marquee=document.ns_marquee.document.ns_marquee2
6 g1 d* i5 w0 T" g; {2 Z6 tns_marquee.left=marqueewidth+8
+ r, u6 F8 V( G& E% cns_marquee.document.write(marqueecontent)6 G" E4 x* K6 S! o, m; p$ N
ns_marquee.document.close()6 `" j- K& W! L% Y( E+ `
actualwidth=ns_marquee.document.width
; w, x4 x( C9 @; H  G2 L% r9 E. E}% r/ {0 h- N/ Z  Q( f
lefttime=setInterval("scrollmarquee()",20)
" n1 I  g/ i& W( _& F$ K( \' {}( L  E4 C3 o! t7 R+ d# l6 |
window.onload=populate
+ @+ H# Q# a, W3 w, i7 u8 t4 _8 x: C$ _0 Q, v* Q) a  R9 p' z
function scrollmarquee(){
6 j, r4 R9 O0 c2 ^if (iedom){
1 c' O5 t8 ~" m& x$ g% D) w& }) lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 F( j8 c: K6 W8 x- kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% ?2 @" f" S4 B
else
0 J, f' Y  a' a) I5 z: n/ T# y1 vcross_marquee.style.left=marqueewidth+8: Y( m/ e1 Y0 U) ^: W

. _6 d/ B4 R% O6 K4 \) \}- S' ^& r  S' \" T; i: K: y* G
else if (document.layers){8 x1 }3 S2 K  u0 f' s0 P# G4 c9 p
if (ns_marquee.left>(actualwidth*(-1)+8))
5 ?/ g, U" t& m; ?  o: U+ L  K! K5 xns_marquee.left-=copyspeed! L0 c" F/ E% ?4 W1 X; y
else
% u: W" `: G( @& Fns_marquee.left=marqueewidth+8
* x8 k8 r8 L# y7 K5 K}
4 b0 {! d; @% k+ i0 l}( e- o: ?, b- Q/ `

9 k( L3 K2 t6 J% P9 Sif (iedom||document.layers){
6 N/ Q) }1 M5 ^! W$ s& Xwith (document){
& [: _: {& q3 gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' v  k% R/ B2 V: c4 |if (iedom){
4 y1 v4 w" F& s* T$ `" ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ k3 I) I( ]9 F+ l4 jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); w7 X  j' Z0 S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): G; z4 q+ y/ w2 t; A3 k; |
write('</div>')1 Q. P! _# k4 @, l
}3 j5 H+ Y  a2 O8 f4 a
else if (document.layers){( ~, I' W4 D0 R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( v. {: H9 u7 }& n( E3 q- B- p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 T- ?: C  {! O$ u3 K* ?
write('</ilayer>')
, e5 h9 O/ {0 c1 ]6 b5 D}3 m8 d/ g3 `" }6 f& p
document.write('</td></table>'). B( A' {8 \5 v6 y
}
% V' O* V. _+ `; v}
1 ?  D# \" q5 R; D% e</script>

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