返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 @! i8 k; W5 C1 @$ f% Q- f- nvar marqueewidth=300
3 g! S) U% {* \) R//高度
/ P, `; z6 g4 k& q/ ^! O: hvar marqueeheight=25$ S3 ~: ~1 O. O9 F" j! E7 ?) G
//速度(1-10)
# y8 z5 ~# i4 F8 y! J3 ovar marqueespeed=3
/ |, v7 N$ A! b! R: A" s//背景颜色) F1 r) ?0 Z2 ^0 B2 |% Y
var marqueebgcolor="#FFFFFF"
" Q, V2 ]5 s- _//是否能暂停 (0=no. 1=yes)?' P! b  D: h" U6 Z( V
var pauseit=19 x$ M& m* Q8 ?
, z+ m% A' K1 n9 l
//修改显示内容
5 O1 r! Y$ C$ M2 \. J. jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* D4 f5 L: B1 K# Q
" Y6 H$ V* O6 u( m; z$ A
2 s/ [( b1 M3 ]% i# V
////下面不需改变////////////
- n, V  H9 O4 J3 i! L
/ K( A+ C2 N6 s: n+ x2 Qvar copyspeed=marqueespeed& F; Z* F2 O- X1 v; r4 [
var pausespeed=(pauseit==0)? copyspeed: 0( u  t- F+ F" I- f* w
var iedom=document.all||document.getElementById
$ q# z8 ^; \+ eif (iedom)
9 n5 w7 j) i  u6 @) `" t1 ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ P" n3 u+ n  \6 C% Cvar actualwidth=''
# W8 D9 M+ S9 R# o8 P1 ?var cross_marquee, ns_marquee/ {' t9 E9 L  y9 j, `+ w
- g& n; I# u) Q* v1 k9 r1 W
function populate(){
  l# z- G1 ]7 `4 jif (iedom){  p! v' {  w  N; o; l. }" ~, w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 f$ f( i$ N' {7 o
cross_marquee.style.left=marqueewidth+8
. s8 p# Q: q* I- across_marquee.innerHTML=marqueecontent
5 e2 N4 {' c$ b( O% h. ^& q1 ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* M+ H: [+ P5 [( J9 B3 e/ A
}
* H& X3 q' @0 Xelse if (document.layers){( z; \" o: }3 d. r0 l' Z0 b
ns_marquee=document.ns_marquee.document.ns_marquee2
3 p0 v8 e% t' R+ Pns_marquee.left=marqueewidth+8+ {+ B  w! F3 F7 S- g7 }' P: t
ns_marquee.document.write(marqueecontent)
3 X4 |- @- E* Yns_marquee.document.close()
& r+ V+ B: w/ y1 vactualwidth=ns_marquee.document.width) a' g3 A1 B( t+ ]
}* M" ~+ p( ^& \, T& d1 U3 y6 K# L; x
lefttime=setInterval("scrollmarquee()",20)3 y( h& h/ p! Z( N/ \) k5 w
}' C0 W" F: O$ W/ L# Q( d9 x
window.onload=populate" B6 f1 s$ a8 m5 e. s5 I

4 Y7 B: F  j- pfunction scrollmarquee(){# F+ p6 m9 b5 S( o  F! r
if (iedom){
, T2 o; p: X* L* lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 C1 g: i$ }' L# z1 t: fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ I6 G- D' D- E3 ^. `
else( K9 q& `, W8 y% b5 [/ X
cross_marquee.style.left=marqueewidth+8
1 O& K+ e8 `& w3 x7 v( d2 _& C' F/ H& R( E9 v
}
1 X8 X* H7 Q; b; D# @else if (document.layers){
1 {# D8 T& C. ~if (ns_marquee.left>(actualwidth*(-1)+8))3 g1 R7 S3 ~0 x) Q) @9 ?/ B, H
ns_marquee.left-=copyspeed3 S  }+ \5 E& J3 M& U& B1 Y2 g
else
- K! Q6 c8 ~3 U$ R* h5 |ns_marquee.left=marqueewidth+8
) Z9 S; f) I+ {7 c, a# `}
1 t& K7 M2 F( g2 V; c}
4 u" n0 j1 u+ ~, C; Y$ c0 v" n' p/ Y; K- g* ?3 z/ b( a) |6 H
if (iedom||document.layers){
3 F5 Y5 x& ?& @3 |, `9 vwith (document){5 s: r$ r* e, g1 F/ {( l$ ~' g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  T5 P. J. {, q$ E2 t
if (iedom){/ J+ A6 A7 ?* c6 S" O9 K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  c" N+ a% U; Y9 Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 O" J) o/ @; `8 _1 l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 J; ^+ q3 z# P) @- `$ |- w0 v6 x
write('</div>')1 a# I2 J9 L0 d% H6 T; o
}* H& K$ x' C1 J; c$ z
else if (document.layers){: g7 X. e' m! b: x. t( O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  H" {* `7 S" W3 c0 K; ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# M! J$ m, [! [% ?/ E
write('</ilayer>')
. B  g0 N6 Z( t8 I: e}* `  y8 G: B. q3 y! z
document.write('</td></table>'): V3 x2 r+ O  D  J
}3 E$ `( A% s: X  V+ `4 g$ w  z; V, h4 R
}
5 q" P2 r2 \+ L6 K/ F</script>

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