获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度. B  i& A# s. v/ T
var marqueewidth=300
! j& m  `3 E' K$ g. \//高度
: I) \% c9 R  P2 L* T0 Z  Bvar marqueeheight=256 P* w) b3 B8 m4 \/ q3 t
//速度(1-10)4 K2 Y+ n: C/ k/ C6 O
var marqueespeed=3
: n! e( O8 l7 t- @//背景颜色: F. z. M0 m7 m
var marqueebgcolor="#FFFFFF"
9 @0 h$ X4 S, n/ N//是否能暂停 (0=no. 1=yes)?
4 X8 f1 A5 ~# T% U! u4 Wvar pauseit=1
+ [& D/ @( h) `& T; r0 L$ |7 r8 g) D. l
//修改显示内容
$ j8 _$ e& F* q) P9 Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 D& H; A2 r6 H8 V" Q

6 h  Q% W6 }( ^$ \
+ I/ F" w2 U- L2 v0 O////下面不需改变///////////// u# U9 `4 [5 R. i+ ?; I7 {
/ B  X6 `. ]2 p5 t# t5 S- {
var copyspeed=marqueespeed: F3 A$ D5 v: `; ^) m! y: D+ |# z" e
var pausespeed=(pauseit==0)? copyspeed: 02 K0 Y7 \% W* P- ]+ Q
var iedom=document.all||document.getElementById
2 e6 k3 g/ F- x: G0 ?+ |3 z/ uif (iedom)1 D; |) h+ p/ n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ A" f: o  k' h6 b2 K
var actualwidth=''
; K7 Y4 `5 h* _var cross_marquee, ns_marquee7 X; P$ Q8 t8 u8 N
# S7 q% }/ V' A. y
function populate(){$ v& A8 K. G" F
if (iedom){6 q- l8 z0 g' }; q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, W* l5 E1 ~) u, f8 ^. `. ccross_marquee.style.left=marqueewidth+8
! X# ~6 v0 B( }# S( hcross_marquee.innerHTML=marqueecontent
9 w' i; @/ m0 I5 t( q' H8 Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; e6 z: H6 v  r' o( A# K9 Z5 n' j
}, s+ C7 |' U% b8 y/ n1 |* ^
else if (document.layers){
8 {+ j% c7 r' f# P$ t% Ens_marquee=document.ns_marquee.document.ns_marquee2
% S7 l/ g. j, \0 Fns_marquee.left=marqueewidth+8  e" c& B1 j# p5 F, @! F, b
ns_marquee.document.write(marqueecontent)6 J: A0 M! [# P4 Y
ns_marquee.document.close()
/ b, C4 g! m2 S0 L4 t8 l' Lactualwidth=ns_marquee.document.width  H6 D) [* e4 D9 ]2 P* r5 H
}& n" B8 u3 W& N
lefttime=setInterval("scrollmarquee()",20). s2 n% w) j# n* U, X6 N
}
2 [# a3 U  r! [  l7 Nwindow.onload=populate5 t( y. h4 N3 T8 \
& T  w; s2 g& D& ^4 L* q2 S
function scrollmarquee(){
/ M: I/ i+ O& z+ l# [if (iedom){: }! M7 \$ T4 ]6 v/ k0 S! q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 r* g1 h9 H* J: {5 n! ^4 V5 f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) T2 g  X0 P+ P; O- P) M
else
' e$ L3 w  V1 F2 N* X( kcross_marquee.style.left=marqueewidth+8
8 i5 |, c' W! L& A# O/ ]$ k; ~$ H8 ^- A8 |
}
0 m3 r1 s/ _7 {4 P% i$ @1 b' Nelse if (document.layers){: Z+ ?: f8 b2 B- e, f
if (ns_marquee.left>(actualwidth*(-1)+8))
0 C- p4 `. O. ~! Vns_marquee.left-=copyspeed1 R! ]& U5 O' W- c
else
, F( j! x/ Y9 a. Q+ Z. d+ Rns_marquee.left=marqueewidth+8
0 q1 j1 f& ^2 F; h}' W: u* l, t" m# d* {
}. v) L( R9 x2 f# t" D

0 j+ z+ p* {, x  u& o. uif (iedom||document.layers){; t- a6 }4 _7 s9 Q3 p0 e( A) A3 H
with (document){: _- f' v; E( o0 B% u3 X0 C; W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. C+ l  }: P& U" |7 F  O; r: k! \6 kif (iedom){
# k8 i- p9 O  B8 p, g+ ~& x: ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 z  m% M4 {& Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 i: j5 ~: D, D5 W4 |2 z2 lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 R9 d8 k" d% F/ X
write('</div>')
4 c. F+ n/ z( ]: R( C}, c7 J! D1 {6 H" o, d
else if (document.layers){
+ l" @: \' O2 D" [( mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 h3 p- D. ~9 m/ j1 r- d( f: ?4 @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' ~: h! P6 i9 K3 iwrite('</ilayer>')* [$ S* o, _& v
}& \; {# A6 o+ r& T3 ^# K- g/ h
document.write('</td></table>')/ W* @7 S0 \$ P" G' w
}
8 x5 ^; @5 ]* ]9 H. G}# ]7 x, E  i% L/ `2 V# d
</script>

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