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

网页之跑马灯文字特效

//修改宽度
$ y3 q: `0 r' ]: X8 q* Rvar marqueewidth=300
+ j  |; H7 i. H% M# J9 f' d//高度
& y, V' u+ q' N/ x& N9 F0 gvar marqueeheight=25
* a  S, H' O" \, G! W8 D- }3 Y//速度(1-10)
# p/ f4 _+ e( {. f% c" @% Wvar marqueespeed=3" \6 O( j( w' {8 E( j
//背景颜色' B% J: }( C0 ~* N
var marqueebgcolor="#FFFFFF"
: |0 q( ^7 h2 V; D' Q4 E//是否能暂停 (0=no. 1=yes)?) u8 J/ x  c' k# K+ u8 j: W/ e7 Y: I1 c
var pauseit=1$ r, ?+ U& P5 H
  E. }0 P6 F  A7 x
//修改显示内容6 J# F9 I9 I7 `% [+ c" H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 c* c: W; k. }. ?2 B1 y6 Y8 |: @% }+ ?, w3 l

* l/ ]7 A/ ^2 D- j4 a& L! j. w////下面不需改变////////////# a9 Q) a7 H2 a, M& I! w. U
" L* B' ?1 |; a# j
var copyspeed=marqueespeed$ q( w3 ~2 n) c1 R5 O7 a, D' g
var pausespeed=(pauseit==0)? copyspeed: 0" \/ i. U+ p9 G: Y) F' S( `8 V
var iedom=document.all||document.getElementById
  D( ?: v6 t7 ~' [& j" |if (iedom)
: D2 }/ F. m2 Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ X$ }' e. u8 Z/ |' dvar actualwidth=''2 u" T9 s* Z: d# L/ r9 S+ T; F; ~
var cross_marquee, ns_marquee
+ D6 D: ]' A! D  L  J1 b0 |; J1 e$ N: x" K& U
function populate(){
0 u  H, P) p6 S: @/ o* T0 b" zif (iedom){) U$ E# r( F  N+ T/ R9 ~, o8 g  k, {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# x: \; [2 e8 x9 \% a3 h+ }4 [cross_marquee.style.left=marqueewidth+8
& L0 ^2 d+ a! ^4 A4 M# P0 [cross_marquee.innerHTML=marqueecontent$ b$ @5 m+ D' L4 h7 j. ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 v8 h& a# x9 U) V}; ~! r& s4 l2 ?+ M# g
else if (document.layers){# y( m) {& q0 L) U- E7 G
ns_marquee=document.ns_marquee.document.ns_marquee23 j0 }' N. K* v6 F
ns_marquee.left=marqueewidth+8
4 ~; A# J4 u: W6 H- b, X+ H7 I( Ens_marquee.document.write(marqueecontent)! ^. h* x& m; y
ns_marquee.document.close()
! h, b. q0 Y/ n5 @7 n8 p0 [" wactualwidth=ns_marquee.document.width
9 u: q) p& B+ g  ]) S, W) e5 Y) }}; J1 v& p7 Z1 P# @
lefttime=setInterval("scrollmarquee()",20), n6 M) n1 _- _6 L$ c* o
}3 P4 m) O$ q- a* S% S" {1 S& {# b
window.onload=populate5 u5 k6 N0 z# E2 L2 ?9 B8 }

( k5 V) ?; }: H1 H" |2 ]function scrollmarquee(){3 z4 S+ l* |! h3 y
if (iedom){
3 i7 C0 c) s9 ^: aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- ~8 C/ l/ ?! c& Y1 c' i. \; C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- h- x2 X. \' f! P
else$ m) o8 ]3 K3 Q: j+ \+ ]
cross_marquee.style.left=marqueewidth+8
! {6 Q, f  c* K- y1 x  P( l( z# f) o; a% b/ v, M
}# ]: ^  S. f! m! k- F2 Y8 B
else if (document.layers){
( N6 u  W% _- R* eif (ns_marquee.left>(actualwidth*(-1)+8))
; D0 |' N! G+ lns_marquee.left-=copyspeed+ e7 d5 q( [9 \( j
else
5 [3 b# Q% q! x4 O$ I! F/ E7 _ns_marquee.left=marqueewidth+8
& n, n2 w* t$ ]1 d) P9 x4 |. J, Z3 ^}
" M/ E0 a7 l+ N: n, j6 d( C}, k& w2 i3 {- x9 [( J  C

, Z5 F! _$ ]) ]if (iedom||document.layers){
# h% v" _& v7 i3 j  j9 s! ?4 Ewith (document){
6 J" T: d* K# p3 f4 hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), E4 @. E, a2 z8 B7 J- F, a& q
if (iedom){+ t4 m, V* K; H( E# P1 @8 e: R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) R) [3 Q2 ?) Y  t2 g* a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 Z9 [1 U* M+ z* Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 o9 Z: M2 F1 m7 i5 Z3 ]% \
write('</div>')
0 k/ R" ]! `# R! X9 \+ s4 G+ |0 I}: s9 U; w4 K0 Y# ~4 m" u2 A
else if (document.layers){  {! [5 x" r8 y0 `+ D
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 s4 @6 C/ I+ Z5 O8 b/ X9 V  n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ c  J) W8 @1 a) f  h! \* n. x% Awrite('</ilayer>')
4 S" ~% F9 o4 E0 V" j}
+ W$ p/ B/ o! a* y8 ?document.write('</td></table>')+ j& F( u- W9 s
}  I/ A7 Y- S. W( e: n
}
6 i! y4 t3 N, X</script>

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