返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% A# q. ~1 Z0 P4 f( a8 _var marqueewidth=3005 v3 |, m) B5 R+ L8 q0 c2 {" k
//高度; H% A% [+ C" g4 P- A9 b
var marqueeheight=258 M3 L9 Z0 q( t3 p0 ^9 l5 |7 Y
//速度(1-10)  X8 W; c8 l* }5 A$ z/ g+ f
var marqueespeed=31 f( H0 s7 O+ M' `8 N5 m1 ^$ h5 O5 ]
//背景颜色. b8 u1 }' C0 v& e8 ?% L
var marqueebgcolor="#FFFFFF"
! \" o, ]- d1 D! _1 w& f+ x( \# m//是否能暂停 (0=no. 1=yes)?
9 Z5 n7 v) b! {  o5 R% P9 `var pauseit=1
  t; ~: l7 @9 k7 J0 z" Y& _
) E" T8 s; e7 s! n8 X1 \* c* h0 E//修改显示内容% Y* ?9 ~$ W. k9 b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( o; V0 ]" @: s" K( `" c
+ H4 i: \9 ~3 L' r

3 h0 Y  U* c* o( ^////下面不需改变////////////3 K$ C- L6 F2 d2 r, o0 c
- d" e% Y" U) P: t/ ]( A; G+ z
var copyspeed=marqueespeed& J4 u/ C9 w% B$ q* x2 n
var pausespeed=(pauseit==0)? copyspeed: 01 P6 l! T0 L, B9 _/ [% h
var iedom=document.all||document.getElementById. X+ e4 q* S  x: n
if (iedom)2 b+ k  _% L9 \0 X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ P7 t4 i3 q- R0 A9 h: r6 ]
var actualwidth=''( u: U6 Z, d  O2 l
var cross_marquee, ns_marquee9 _9 }0 Y2 ~, k; E8 M3 N: [, O8 U$ C
) o1 K* m! B* l* M
function populate(){8 D: {' f6 m2 c, j: N
if (iedom){
! B: U$ q8 L4 c( r, @1 \cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 a9 i* I3 l! M. Ocross_marquee.style.left=marqueewidth+8
) I, ~& b: X* R) D1 W) Ecross_marquee.innerHTML=marqueecontent
2 V0 k- Y: G, P) P5 tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- }* H9 Q9 }, i8 r6 V- B9 Q+ o
}
6 w% ]0 S% T6 Belse if (document.layers){
$ U! e, F% d* ^ns_marquee=document.ns_marquee.document.ns_marquee28 d+ H6 E; m2 c( K1 C
ns_marquee.left=marqueewidth+8
8 S) Z+ m1 p0 i' Yns_marquee.document.write(marqueecontent)
1 b' Y+ s# I7 ~, Q3 Q# Ons_marquee.document.close()
1 d& E$ ^. B. k) m3 @actualwidth=ns_marquee.document.width# W7 W* W/ b" t3 u8 o; O  W& o
}
& \- R, I  H2 W/ Llefttime=setInterval("scrollmarquee()",20)- `: s. C- u& a  V( N
}
4 [, B' Q! s) c8 J  qwindow.onload=populate
* D$ R8 V" N; ]$ J. m" P% g, a! b4 t
function scrollmarquee(){
1 |  _+ t1 V* K. F! t: F+ Vif (iedom){
  \" Z% D% p! [! O' O' ]& p; k: hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- \9 i- l! u, F' N6 b" n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ [  W; C( t0 ]4 h' W! Belse
$ ~# u: d: u$ j) scross_marquee.style.left=marqueewidth+8
5 D  D# Z3 J: V, e8 ^* O4 O+ l9 t) I5 E( [4 P
}0 S( P  t- J; z9 }& j; j" l! J$ [
else if (document.layers){5 c/ y7 u1 \" o4 [6 b
if (ns_marquee.left>(actualwidth*(-1)+8))
! t% g2 N# `% N! w4 e$ P& J  l+ Fns_marquee.left-=copyspeed
2 b* ]+ ?7 h& I7 J, X4 U6 belse
9 c5 o. S- E7 N4 W4 X4 L# I6 Xns_marquee.left=marqueewidth+8
8 Z8 m  U$ u# }}
9 h6 r& p6 v- `}* Y5 X5 M4 z2 w# h. E
; e% o8 i+ i0 X
if (iedom||document.layers){- n8 M3 i3 U# z1 R) E/ w: v, j5 G5 v
with (document){
. e  F& Z( O$ }. u# fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ k- n1 y# W+ H" ^8 h! @  r$ b
if (iedom){2 B1 z2 a/ I- V8 t, a0 }- M
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- K% |8 V5 u8 d# {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# H% B& q* F3 g. gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ u* i. ~5 V) ?* q% R6 X* Twrite('</div>')
: N. V+ U1 h# J0 S7 A7 O4 a" \}- ^) {  v$ a; s/ z8 U4 R" q
else if (document.layers){
$ G2 H& x1 l* [; `; E: n: Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 Y! n0 y( j, n( ~% D( o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): x: P6 O+ L) e# k! F$ I( N
write('</ilayer>')1 U  k3 Y  |; I- {/ O. L2 Z$ O0 t
}
( U: K& P. R% P. |# vdocument.write('</td></table>')
4 p  _+ y# M* g- k# e0 K% u9 ^}
( o1 s5 {( a4 E0 w+ G}# M$ S  _3 o$ m$ H* M
</script>

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