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

网页之跑马灯文字特效

//修改宽度
9 u; J) d4 m( @1 g$ X* E/ G% X5 `var marqueewidth=300
  c5 r' R9 i) R& r  J6 E//高度
. Q9 b9 {$ w# t- ]" A/ y5 Wvar marqueeheight=25
  W; ~+ ]' o4 ^//速度(1-10)& n9 d5 T. Q9 N  G1 e
var marqueespeed=3" j9 c" Z) p8 s) A
//背景颜色* a% x# k; q5 i& Y; b5 P6 {: |/ {
var marqueebgcolor="#FFFFFF"
( u  {. i" l# r7 g//是否能暂停 (0=no. 1=yes)?, f8 D" l' T/ u  H4 k7 g5 A' b: }: g
var pauseit=11 G# }3 M, F* ?6 a; ~) {1 W
. S1 F# X- c- @* D/ [/ K
//修改显示内容* j: ^! q! T, [* A# T$ X; D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* g4 }( ?- a' l2 x" N
4 Q+ q+ u4 S5 H/ _8 D' S+ a5 O( a+ E/ {' y& p. w6 F1 k# O0 F: h
////下面不需改变////////////' B& ~3 g8 @9 l  m

3 Q) e$ K$ n# M0 ~' }var copyspeed=marqueespeed# [6 d$ g) U. M$ o1 T1 U+ g
var pausespeed=(pauseit==0)? copyspeed: 0
2 A" ~$ z7 I$ B$ O; evar iedom=document.all||document.getElementById
" J! D2 `3 p/ jif (iedom); W  x" U" R+ P) F* J: j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% L9 r6 H6 X( e; o; ivar actualwidth=''3 x* a& _0 \- a# n
var cross_marquee, ns_marquee( k. U. o1 S# w) j6 |

2 L% w# H3 @3 [9 M* _! xfunction populate(){# P6 _2 |4 m6 {! W
if (iedom){
: T! @$ l0 w0 W) V) o1 G! dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 W3 s+ `1 s, L3 p8 Dcross_marquee.style.left=marqueewidth+8
& ~0 E0 w6 J, _' mcross_marquee.innerHTML=marqueecontent
0 h& h  f1 C( G4 H3 M1 ?& Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* h. x% {8 t9 f6 ^! C
}
! e) a) ^' t1 D4 [) aelse if (document.layers){/ O+ a8 B0 G9 J: ^. K
ns_marquee=document.ns_marquee.document.ns_marquee27 S3 [0 W6 m6 v  G9 R
ns_marquee.left=marqueewidth+8# Z9 N. C( n& M1 Z8 Z' R
ns_marquee.document.write(marqueecontent)
  t7 e# q) {3 S' R! S8 A- ans_marquee.document.close()
6 G3 L3 F7 H+ }" wactualwidth=ns_marquee.document.width
  w. ?$ T, K8 \: J# S}
3 h7 O  ^7 \# g9 m1 D4 X0 ]% p5 y6 y2 ~lefttime=setInterval("scrollmarquee()",20)  \0 g# A" e& P! O! q4 b0 h4 f
}
! H* h7 _! o. i0 r) Qwindow.onload=populate7 w% A1 E: d  b7 w1 G: ]" B' b
0 Q& \* p+ O2 {- C; V& V
function scrollmarquee(){: ]2 f' J' V. e& W
if (iedom){5 ~3 {6 d+ e1 V4 f# l, f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 ~, ~" I! z6 h% U0 ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 P% D0 E  G( @& X+ Q* uelse# Q) `# m, M# n
cross_marquee.style.left=marqueewidth+8
2 q; f3 C% p+ K8 \/ o% y; T+ Q# Z' ?* y, g+ W
}2 s0 E) J/ p5 m
else if (document.layers){* o" C/ i2 A; R$ L/ s
if (ns_marquee.left>(actualwidth*(-1)+8))3 z6 g& Y& f# I8 D
ns_marquee.left-=copyspeed
( b, J: n4 d0 K% {0 A) l$ Z. velse
0 ~. c& h6 S) a" P+ u: _7 |; d% lns_marquee.left=marqueewidth+8
1 M7 i, |9 Z8 D" I$ ?}. h" p5 |: \- k) _
}% u7 i" Y) l# U6 O. @4 C

) h. {: [& c1 E% x( gif (iedom||document.layers){1 y. Z9 x3 v  j& p
with (document){, K8 n) R$ o' ]2 R" o" q5 T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); f1 S( |( ]! n) a; h7 i
if (iedom){, m. `$ G" ?- W9 }5 _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& w; r: S% }9 e9 }, c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- Z7 `1 |4 y" B" U1 |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( B0 v! v) W, `% `$ @2 Uwrite('</div>')+ T$ \8 J8 D# R$ C% o) E
}
& }9 V6 n/ [5 {# l, }* i! melse if (document.layers){( N1 K0 C9 o% g; m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& N4 U6 L7 e  D) ]# j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* m* e4 A2 ?# b, r- n- {$ i( `
write('</ilayer>')( r7 x9 K& ^4 q
}
! O" i1 T5 X  J+ _" ddocument.write('</td></table>')* W; J0 i, U! _
}( k/ l0 F% R% N
}
* L- g& d. v& f8 I2 ?4 J</script>

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