返回列表 发帖

网页之跑马灯文字特效

//修改宽度! t" E+ d* t+ ~1 q
var marqueewidth=300
0 Y! _( q: O- ~$ S0 q& Q* n//高度  u- O( }/ b/ y: D1 K% h0 E, J# h) u
var marqueeheight=259 `# D' Y9 g( c1 G/ i* q6 |; s
//速度(1-10)
' j# S0 c* ]6 A7 Z# C' kvar marqueespeed=3/ i4 X% S4 c4 D1 h  I# w) q. q0 _
//背景颜色4 Q- f- h+ B% I3 a1 m6 x
var marqueebgcolor="#FFFFFF"% j2 B1 J0 L# p9 y3 g/ s' v8 M. S
//是否能暂停 (0=no. 1=yes)?$ D! C" @- U/ |  J" g% e1 l
var pauseit=1: U5 s* `( q' \

0 D2 W' M, E4 d/ Y1 C//修改显示内容
+ A; D/ ?8 n, Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 y5 e/ p  H' P6 D1 M
+ \0 u6 u5 n, `; O- [) A" \8 f# P, [! l+ n5 b. B9 d7 e
////下面不需改变////////////
2 s' x* h3 |( O7 J1 I, J- M2 j4 o7 r5 ]* L
var copyspeed=marqueespeed
2 K4 Q- y% e5 x9 \9 a; [var pausespeed=(pauseit==0)? copyspeed: 0
1 ?# b0 `5 R6 [7 G- t4 [var iedom=document.all||document.getElementById# k- u8 K0 W9 p, A* I7 O/ M
if (iedom)( Z6 U! g$ S2 W% d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) d' L0 v1 ?' e0 Y
var actualwidth=''
, d4 k0 g" `' F+ bvar cross_marquee, ns_marquee
2 H( x, z4 X7 z: }5 @  s; X1 a: y% K; u+ R3 ]5 q' h
function populate(){& R" l0 J9 d- ~* X1 ~
if (iedom){
$ |7 ^2 o4 b" _" N; F0 `+ Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! ^- Y4 _# d& |& ]# h" s) Zcross_marquee.style.left=marqueewidth+8
) i1 u7 \( L* g5 {) k- J" f, \cross_marquee.innerHTML=marqueecontent( {, w5 J& ]+ u* e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ {# x3 }! P8 ^
}- h: u0 J# F; S6 F0 t
else if (document.layers){
; h0 H9 s1 x2 o9 {6 `ns_marquee=document.ns_marquee.document.ns_marquee23 ]& N6 o& L' m7 h( D" A+ w4 G$ @. f
ns_marquee.left=marqueewidth+8* z( m8 f3 I% o* A
ns_marquee.document.write(marqueecontent)# m$ Z% }, j- {* f3 l
ns_marquee.document.close()
" k* S; F; l' mactualwidth=ns_marquee.document.width
6 B% h% e/ Y+ G}4 s3 q. Q! V1 |+ H( P$ J
lefttime=setInterval("scrollmarquee()",20)7 {3 t7 }) `; ~% h
}
9 O1 ?! N7 ]! u. J) ?4 zwindow.onload=populate: z" n3 \9 y4 z( Y) @3 C& y( t3 g
  L  D. a5 T6 S) K9 u( \
function scrollmarquee(){
# B$ a( S& d( k' p! B& r  T9 r4 l3 @. \if (iedom){' ]5 M: K6 W1 @6 u  X& B9 Z8 X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 P/ w9 G8 Y' T! f0 i0 ^& h" S1 |; Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 M6 k+ j) n, }* }( q! ]
else
& v, r# J" m! ~7 w8 mcross_marquee.style.left=marqueewidth+8  z- \, q( T9 L9 p: E% U0 O) H
& g1 @% w" ^- i" N
}
$ j: P! G) X1 ?- O! selse if (document.layers){2 `" s+ A  O3 j
if (ns_marquee.left>(actualwidth*(-1)+8))
& i4 |+ g: t" G; _7 C2 }4 ?: \. h5 |ns_marquee.left-=copyspeed5 `; l0 F& s+ Q# E1 y! S: u* M
else
5 P0 A$ t/ ~4 w3 E, r* t8 R+ tns_marquee.left=marqueewidth+8
+ ?: p; O9 t! U}
0 Q+ K2 N3 h/ F  `( o- `}
% F3 Q8 r% I/ W8 S% J8 y4 x: i0 E. M$ x' m; s/ i0 r( v* {
if (iedom||document.layers){
$ O/ \. Q+ J( M! O1 A$ F/ Mwith (document){$ j+ g; {/ F8 }" @2 }0 F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" ?. _6 M4 ~" {4 I  R2 yif (iedom){
2 P6 z9 i8 `" `* C" t" \- F! Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. |0 T( E6 C& o) V6 b1 Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 `& m  B4 O4 x, |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 M* m/ l- }7 f+ O
write('</div>')
) [1 m( }( p: V$ ~}
( Z& f3 Q# g3 [8 Selse if (document.layers){
- h  w! F! Z0 i. dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  n2 F: |8 b3 w0 C6 X3 _  c. b$ lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' K. x6 S1 m& I$ \: _$ Y% W
write('</ilayer>')
+ l6 a8 k/ z) {: x}5 B# t5 }- ]) `: U- e
document.write('</td></table>')- \& V! u; T# C
}
! W2 f0 r: I' f7 i}
$ z6 ]: t2 o9 Z</script>

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