返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! u. q4 w- P8 o* c0 wvar marqueewidth=300; F4 r3 }4 }% `- p0 i  K
//高度
* w" F8 U" i  H! U6 Pvar marqueeheight=25
* u9 ?' @. x5 }* `//速度(1-10)8 L6 a, H4 f& e9 \8 E
var marqueespeed=33 j3 a7 W' R0 o
//背景颜色  {  |- R$ J' [+ X/ ]
var marqueebgcolor="#FFFFFF"3 ?6 ]" j: ~5 x. f
//是否能暂停 (0=no. 1=yes)?
; c8 ^8 l' w) T3 Xvar pauseit=1
, r+ S' g) U# _8 P* z6 l  m" A% N6 J: l) O: t  x
//修改显示内容3 P3 _- ?7 B2 P, ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ e9 ?/ T2 I+ b3 E( r; v, Y/ V) ~% ^5 A* B1 T  [2 P

% E5 b$ V! A) h) g* m////下面不需改变////////////% H( Y8 n$ i; B
0 `) V, V0 T9 F# a9 u' o1 S6 U
var copyspeed=marqueespeed6 ^2 U6 E2 w) s: I- o8 A! \* M9 V
var pausespeed=(pauseit==0)? copyspeed: 0
& [* h4 c* f& Y! Z7 S5 zvar iedom=document.all||document.getElementById
/ M- n. V. x2 p9 K/ ?if (iedom)
9 f" F1 @+ j( Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& e) b% I- `5 Vvar actualwidth=''- O( b  \5 v- s: K. N
var cross_marquee, ns_marquee
# |  G3 z6 m" A. s: [: [# x% P$ D9 E1 ^5 G9 r
function populate(){
# c5 [6 H8 y5 ~( T/ q( Y& ~if (iedom){
9 U( _) e4 y% J9 s( O' R" @: M* fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 b' {$ _7 o; s7 Zcross_marquee.style.left=marqueewidth+8
3 `- M% p+ N: b* D* [, {2 _cross_marquee.innerHTML=marqueecontent
! Z) P, r. C0 ^9 h6 xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! i2 I7 S' G7 D2 c0 A}
) V- c# z# }( ^- t+ X% d) pelse if (document.layers){9 n) c7 N5 T8 b9 o- Z6 Z; E
ns_marquee=document.ns_marquee.document.ns_marquee2
$ y. z8 l4 R- P' Bns_marquee.left=marqueewidth+8
7 Z+ G7 ^" V* G) A6 mns_marquee.document.write(marqueecontent)$ o/ D2 j. N! h% x
ns_marquee.document.close()( L$ p# r' W2 c6 J
actualwidth=ns_marquee.document.width
: E7 Z0 \& O( y& m$ r2 N3 ~3 O}
" v+ V/ y1 T5 C' o  Ylefttime=setInterval("scrollmarquee()",20)
* B: I' e4 c5 e}; M. `5 J# P, z  I8 r7 y
window.onload=populate
6 H' W5 V+ R* f! g- J: s: }! d! L/ {1 k6 U+ f$ t9 i+ c
function scrollmarquee(){$ S- p  ]2 L1 P& n* l
if (iedom){7 [$ w+ ], F: e! y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 z( m) C$ ~7 b8 T6 wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; Y% G  k/ W& O( K4 W% j& Jelse+ L" O& {! {3 J1 C3 Z
cross_marquee.style.left=marqueewidth+85 a$ L1 T/ i1 n4 b: x

# O& @0 c$ V: N$ L1 @}
9 T, v8 o$ n# M6 S: [5 ]7 K2 K$ lelse if (document.layers){1 b& P4 A4 {7 y4 _) M& I
if (ns_marquee.left>(actualwidth*(-1)+8))
) B1 \. X5 O: U/ P" jns_marquee.left-=copyspeed
& v' U+ P! F, Gelse" I. j+ [% L& y( `# ?" y, v
ns_marquee.left=marqueewidth+8
+ f9 p; V/ l2 M5 U7 P4 Z}
, _2 x4 k3 a5 b3 Y}
( @/ y4 ?2 f6 h" J/ Q! k  @- H) _% k' x! U' j! C2 I/ \
if (iedom||document.layers){3 M4 c6 ~& E6 y4 y
with (document){
. S5 ~- O, o/ f' q; adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 _! j, x& R2 v, B; H
if (iedom){' T" N5 f$ U; I: Z8 T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( Q7 o/ H  \0 N3 V$ k, R1 xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 j$ ]) X/ w% K2 E* J4 lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 I# g0 L$ V1 h0 Y1 y( Y
write('</div>')
/ [2 k* E9 j, P( ]+ n" U}4 D, v/ h: v+ a7 X" [1 C9 x- ^& n
else if (document.layers){
% a* T$ x4 ~2 H& c( P9 Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ o8 p3 N/ d0 ^  u
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 B+ |/ W* ~2 p& L. \9 i
write('</ilayer>')3 D/ O1 o' D3 |+ a7 ?5 n4 b
}
+ M7 P9 i3 R" g/ v( K3 V. sdocument.write('</td></table>')
; Z# }" m. J" J% W" H7 Y6 n}
. b  p+ M* D0 r}  B+ F' F# B: c- x+ S" i
</script>

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