返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 K( R% ^. d/ g
var marqueewidth=300
: I% T- N; I+ V# c. `' z//高度/ ]3 r: r! S: j# u/ J. v1 A$ O
var marqueeheight=25
3 o" S/ ^: v' V& h//速度(1-10); n) A! |; p6 ^/ q
var marqueespeed=3& }. l7 {( e) [; c
//背景颜色
" I: j- ]) _+ N. o' N: Z( Wvar marqueebgcolor="#FFFFFF"9 o4 E7 E6 g, k
//是否能暂停 (0=no. 1=yes)?  X1 n* j/ [- p" S" {
var pauseit=18 Y8 ?* P  |$ j/ k3 N
6 j0 Y$ I' K" y: L( \
//修改显示内容
- ~2 y+ _% r$ n( j" U8 P: evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ l) F- P/ K5 i" A7 W( ~

! ]! K, h. T4 ]3 V
5 m$ l# h& O/ P, O7 b! [( N8 L* L/ {////下面不需改变////////////
. m+ W3 u/ e; [/ k/ _3 H) r. W! n7 v3 ?7 ~% G$ \0 `* C9 p
var copyspeed=marqueespeed; F/ ~" P* m3 _9 t; @
var pausespeed=(pauseit==0)? copyspeed: 0$ K7 j' L2 H! M3 K# v' `
var iedom=document.all||document.getElementById
$ F* [( X: y+ R( dif (iedom)3 H  G. d- o+ P4 p: W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( Q/ T8 t, `2 z" X$ kvar actualwidth=''
1 A2 p; a/ f' e$ d' k* v" [% qvar cross_marquee, ns_marquee% m. k  G: H: T

6 b8 Q/ ]. ]  Z4 e" c8 E7 f2 L$ jfunction populate(){2 B9 M! ~" l5 D) z2 V
if (iedom){
; ?/ G* J9 {- `/ p4 E# Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ t$ v# s- [6 U3 |, f
cross_marquee.style.left=marqueewidth+8+ ~( N7 [% S* d% v. y$ l
cross_marquee.innerHTML=marqueecontent7 F4 l3 h6 |( {% k. C8 V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ V+ w$ R; n" k+ W' A% ^2 `+ V& [8 x
}
. O1 m  K/ Q- w6 k/ {! D3 {/ Felse if (document.layers){' T9 L( k" _' d* g8 l: F& T
ns_marquee=document.ns_marquee.document.ns_marquee2" V' f& W5 Y3 p! \$ M( B
ns_marquee.left=marqueewidth+8
6 ]3 M  |- l! d8 i" sns_marquee.document.write(marqueecontent)
1 s) ~- g- C  r( d, k4 q+ nns_marquee.document.close()
. h8 v! r% o: g5 X# |actualwidth=ns_marquee.document.width
0 L+ q8 g$ B- M% J/ J& W}2 }- }/ L" O" t) r! i
lefttime=setInterval("scrollmarquee()",20)& O9 l/ g$ t+ g2 s: j8 ~/ Z$ z6 G
}
7 I, y2 s( S/ G, q2 r9 ]window.onload=populate" L6 |7 d* G/ i8 m
. q) C9 ]: D! y4 M  Q8 \2 F
function scrollmarquee(){
$ B1 w& K0 N1 t, sif (iedom){& o6 T( U0 H* ^. i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  s) |/ G  F; p% {; dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) _' }7 U, `) l+ u& R5 t& n
else
& W; \: l+ G% A& h+ i) r4 A* \1 tcross_marquee.style.left=marqueewidth+8* z- N! m8 d7 f* }1 `$ j
5 ?% C- E; w1 b, `% z
}
, j4 ]& Y* ]8 p- l2 [else if (document.layers){
& [' O+ x! `8 F- F' @) nif (ns_marquee.left>(actualwidth*(-1)+8))) w- [1 a: G- u, _& _
ns_marquee.left-=copyspeed
* j1 F4 U+ e  u8 B7 Xelse
: r% b. i) j! n+ S. Uns_marquee.left=marqueewidth+8! A+ f# V$ \5 D! E2 V4 U
}
& Z+ O& f: K6 c! i0 ~6 `}, F3 }3 Z3 g1 A3 v

1 K* r: m* F, dif (iedom||document.layers){
1 _# C5 a) w. i) t; p+ ^with (document){7 z' Y& _  n; W7 X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- x8 `; K& e6 k) o4 f; ~
if (iedom){' D0 x7 y7 A" f  ~9 J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 D$ [% g. c% }: x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ j: u, f& w; F, v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ f% |, ]3 ~, Z
write('</div>')
3 F  \2 o. q. K) `9 g5 Q- @0 j}* ]1 o! n9 ~! A, V2 h
else if (document.layers){6 M/ n; u" c. O: j9 X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! }# H# u  ~$ K! ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* L. H9 `9 V% Q0 ]& v# `$ v4 j9 s- t
write('</ilayer>')
; t& Z8 b( S! A) H0 i}
5 l5 O/ x, C9 S5 J! c8 wdocument.write('</td></table>')0 Z; k! ], I6 p, L$ {, B+ [
}
# T2 C( y7 ]# J  r( o1 R  C}# b" E" \. V6 ^5 U. Q- E) u
</script>

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