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

网页之跑马灯文字特效

//修改宽度
" t" ^) u4 x  v7 I: C; ~var marqueewidth=300. ]8 |" X5 W( W
//高度) ~1 [2 [0 |  C. u0 l7 O0 f
var marqueeheight=25. s) D7 I; \; K
//速度(1-10)
" |! L3 V- G4 Cvar marqueespeed=3& N; r! C8 Q( n2 {; w: C
//背景颜色
  p- x+ I9 D; S1 rvar marqueebgcolor="#FFFFFF"  U( I) u& Y) p3 X& b
//是否能暂停 (0=no. 1=yes)?  t/ P/ ^+ G6 g
var pauseit=1% ^. F; T$ e# @( ?, G' w/ C' G3 ^
+ L4 z9 ~( @; w$ ]
//修改显示内容
# D5 @6 P; B! ?: l3 @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# _% w7 R+ `  ?4 n
7 E$ |) o$ Q; A. m3 M$ x0 z) V$ l6 k
4 [! F6 F% j, w7 Q. G# k" ]////下面不需改变////////////- L6 j6 v9 p! w7 ^+ V

+ W0 h. ^2 y/ r! i3 {1 }6 w  tvar copyspeed=marqueespeed
" S5 ]# k2 U+ l  D- C; a2 svar pausespeed=(pauseit==0)? copyspeed: 0
8 l* w7 Q2 h6 zvar iedom=document.all||document.getElementById
4 a* J7 L3 A& h% R' t7 \if (iedom)' i1 @6 B/ v0 ^4 H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 C  r3 b' U' K, e
var actualwidth=''
& p& C; {6 N& X+ T3 @7 Q3 ovar cross_marquee, ns_marquee; v* m( |9 D6 B
& W' X5 b; z/ o( y' k/ ^( A
function populate(){
1 |# ^4 f7 r+ M% K8 ?" N1 Iif (iedom){
5 K: y5 b; N4 d' T- lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  {5 Y2 L$ j- P+ `
cross_marquee.style.left=marqueewidth+8
+ q( a- \8 ?: Icross_marquee.innerHTML=marqueecontent; \$ n) K. ?6 V) A8 B7 E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  C5 I3 y- f( Q3 w. }+ P4 T& ^}
# ]" N+ m/ @1 C( f# c% x$ Nelse if (document.layers){/ H2 y/ D8 D  [7 I
ns_marquee=document.ns_marquee.document.ns_marquee2
/ v( R. s* ]! R# l: E8 \% ^; Mns_marquee.left=marqueewidth+8  p; p8 s# a( V
ns_marquee.document.write(marqueecontent)0 |$ ]1 T, c) d- O# C, P" U( S7 W
ns_marquee.document.close()
. W* w! p3 ?* ?4 J5 Vactualwidth=ns_marquee.document.width, b$ W' I" U' g; D" |
}
# d; V( U7 X5 U' clefttime=setInterval("scrollmarquee()",20)7 c  I0 T. i/ r$ z
}4 q, U, Z1 M2 P" C5 N* Z$ x
window.onload=populate5 A1 T; s# j, N

0 F/ f4 s( |6 G1 Pfunction scrollmarquee(){
0 B- a" {& W- A/ p( v+ Z: Q$ hif (iedom){( {/ B2 N. @2 a  `% ~/ Y" t7 c; _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) w" y' [! i; F% `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* `2 M4 N  H. Z( Lelse
1 Y) c$ x$ x5 M7 `5 s$ V8 Qcross_marquee.style.left=marqueewidth+8" u, i% B  u+ _

/ e1 Z* \% K0 K6 c' h: B& b3 i}
3 f  S2 T0 |7 selse if (document.layers){
9 |. |# g! p' d  f6 A$ W: cif (ns_marquee.left>(actualwidth*(-1)+8))
- _5 i9 m9 O7 |7 {& \  Cns_marquee.left-=copyspeed
. W3 j- x0 m) b5 M6 Delse
0 b7 @4 W" R- vns_marquee.left=marqueewidth+88 R3 b8 p$ }8 g! I$ d+ a
}
- }6 O+ P$ u4 D}! W' ?5 d+ f6 X" g
+ w: l: D, g+ h% Y3 I+ @( w% h
if (iedom||document.layers){
6 u, E! a" R$ N3 v& Pwith (document){
: z0 r! \& H( bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ X+ ~& `6 M2 }/ x6 Kif (iedom){% a( E( Q' W' ]% N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): Q) b2 f+ P+ x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ J# e+ f; f& P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& x1 m! ~8 @. uwrite('</div>'). s8 ^1 M- ~. F/ F( ]7 c
}6 a. v! Z* i8 ^: s6 S* ]
else if (document.layers){( _5 R: v& H+ W  L5 E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* F5 Y5 t* R( \  C0 d, L) {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( f4 Q# Y& a( z# B; p/ e  |write('</ilayer>'): L. I. w5 k& C4 m0 O/ }' h, @
}: L" f  ^# Q8 E# N7 f0 k% i
document.write('</td></table>')
. `6 g7 V, O, c- ]7 A7 _- n}3 ?8 F$ O8 Q, h5 D
}
- ~( J8 x/ n- `; W3 Y</script>

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