Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度
, ]2 _& ]# I5 dvar marqueewidth=300  t) a8 {7 s% Q- |2 W
//高度
/ y8 Q. o+ T+ ?+ x4 wvar marqueeheight=25
: x( I; {' T' Q/ }//速度(1-10): U  w$ e; p5 U$ q' J
var marqueespeed=3
+ G0 ?  I! H% y" D& _( z5 X! ^//背景颜色2 T) J! `/ D/ N$ c
var marqueebgcolor="#FFFFFF"
+ e& f3 _% {- I/ T& w. z' _% t: y//是否能暂停 (0=no. 1=yes)?2 O* y; R2 C4 f( s& V0 o2 s
var pauseit=1
/ \5 _: B8 Z1 ], G+ f' ^! F
- d8 g$ o/ U5 `+ t+ g% }2 K# g2 J//修改显示内容
; i# k% c" N5 {6 gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ ~5 G2 I  V& d1 ?6 v7 f$ K: _
  r9 W+ K3 r+ }2 z0 i1 X
. b( e- `( ]) d0 E! v5 h) t3 Y
////下面不需改变////////////& s$ ^) x# R! ]' w& h

9 [. F8 z4 o0 U3 M5 Z4 Gvar copyspeed=marqueespeed" C) c* I7 v6 c& A. b( s, \0 z' B
var pausespeed=(pauseit==0)? copyspeed: 0
. }# t) l8 E5 D" J- G. {var iedom=document.all||document.getElementById
) u0 u( O/ n" K5 Zif (iedom)$ I  V$ l- L' L, R0 v: V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 }6 u; v% n2 o' B$ D7 N& E
var actualwidth=''; m# K& O/ x. u* ^* E
var cross_marquee, ns_marquee
6 T) X7 e1 G2 n
/ n/ S0 W; e' q6 C$ d+ ofunction populate(){
% v+ I7 p. n" V! Gif (iedom){$ T/ m2 Z0 B8 U3 O6 w7 o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% y5 _% C) ?* U/ M3 h8 J6 \3 c- q
cross_marquee.style.left=marqueewidth+8! R! I* Y! {7 K  C# d8 V, Q& W
cross_marquee.innerHTML=marqueecontent/ p, X. L; T% ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' R6 r5 l, l( v1 s
}9 d1 X0 c$ Z4 J; f7 D8 ]
else if (document.layers){, \5 o/ p: g5 u* N! Y4 c+ n1 \
ns_marquee=document.ns_marquee.document.ns_marquee2& s' s* {8 ~5 g) U$ e/ ~: b7 Z
ns_marquee.left=marqueewidth+8  T$ q2 n+ Y" ~1 I# e; a' O8 P
ns_marquee.document.write(marqueecontent)) a* a9 f3 T4 S: g/ N" g
ns_marquee.document.close()
$ J$ ~- c4 I1 V1 ]7 V' d5 j) Aactualwidth=ns_marquee.document.width1 F. U$ `' ~  d* E' w
}2 p$ l: C7 l' w
lefttime=setInterval("scrollmarquee()",20)
  k3 i( w% f( }/ F- X: d& X}5 @' Z  C8 F$ {9 R
window.onload=populate7 l* S% u9 o1 D, R

' G0 q7 G! J# qfunction scrollmarquee(){
) T) |* }& R% p* u: C. \if (iedom){+ X! v3 t+ |0 Q: N, K. N" p: w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% }4 ~6 Z% w- `9 a8 O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) p' w+ @3 \, O1 H
else
. _" G1 I0 x" e, [cross_marquee.style.left=marqueewidth+8
' m$ I: [1 ^" c3 B# t5 t
+ q7 F2 ]4 [* k/ o  X5 _}
" j% p0 x8 ^& q/ {/ melse if (document.layers){0 `8 h+ j6 w, y; [9 ]
if (ns_marquee.left>(actualwidth*(-1)+8))# d  U- y  G" I) r& I: ^
ns_marquee.left-=copyspeed3 f3 y6 k# N% Y9 `9 [
else
  Z# P. G' z2 [9 O, t3 _1 [3 \ns_marquee.left=marqueewidth+8
! t5 n7 D8 ?& \9 I}9 f' G- o/ [: c+ A
}8 l# A& {7 c) n4 C, |

; `0 ~- |" t% d# v- _if (iedom||document.layers){
# ?2 Q0 G. T  ewith (document){
6 V, q2 h' }- i8 |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) I4 I* R, H1 b7 J- J* Y% O5 g! kif (iedom){" V& S. b: n0 X% w) D: k. C5 \' E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& b; g6 x6 c# n, c# A) D: p7 {3 R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) r9 a8 ?/ f3 j9 M/ f" p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ D' J; P# V  e! N0 m- D* b
write('</div>'), S$ |( R* `- E  M2 g  v
}7 ^! i# I6 f/ j0 J  r3 a
else if (document.layers){
: q0 C, \( U: u8 ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 C) O0 [; {* V9 v* ^) D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' T" l! F5 K1 H1 m- S/ O
write('</ilayer>')
) f4 |( b  L1 m}
. e/ j& }1 \3 o. D. A$ ^3 ]9 {document.write('</td></table>')
4 }$ |( o( z) e; K- J4 z}! n& q( H" ]' B6 D$ }
}3 _& F! e* a4 u) F% e) p3 N  G
</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2