返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 T( m/ L! ]# Z" E8 B( [
var marqueewidth=300' D7 W/ H/ O/ p" a; q
//高度: o' G% c. Y7 M
var marqueeheight=256 y4 t) l2 ?9 `4 G0 L5 T8 Q
//速度(1-10)
4 M; g3 ?" J% w/ qvar marqueespeed=3
7 W/ F: i9 L- n//背景颜色
( O1 Y. r4 K1 g4 t. g6 k) `8 pvar marqueebgcolor="#FFFFFF"
8 I9 |8 B+ l4 _2 ^4 K  [//是否能暂停 (0=no. 1=yes)?
7 ^, I; F. b: n. D0 c4 [var pauseit=1' o; c  J9 E3 ~

% O' n1 q8 |+ Q5 H7 q# k/ y//修改显示内容6 A( F% \% |. U4 G6 X* U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 c! ~/ k0 c7 r5 J, o

1 w4 W2 `+ f" f4 z7 N4 ]
. w% |  C  x# p////下面不需改变////////////  i9 p# e& O* e0 l% T' R% I- V, ?

) Z  ]9 m8 T4 t( E3 ]* Yvar copyspeed=marqueespeed
1 o& q6 H" t  c& h) O# zvar pausespeed=(pauseit==0)? copyspeed: 0* J$ l, j2 o* g+ [4 e1 X
var iedom=document.all||document.getElementById# |5 m6 e% f+ ~
if (iedom)
4 f8 ]' R) a4 g- X4 N1 gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 f2 I3 x$ V. R  d
var actualwidth=''5 {3 ?7 A+ [! b$ |- O3 ~1 x4 M. Q" {" ]
var cross_marquee, ns_marquee& ]2 U9 U$ K. z1 [
% q3 B1 ]$ H2 g. M$ C
function populate(){
: c; K* n3 |+ T7 B- H* M0 Y& eif (iedom){
: p6 L  s! K! dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 w0 `  X& ~3 p+ Scross_marquee.style.left=marqueewidth+8
) S" C2 ?0 @" `( z+ _cross_marquee.innerHTML=marqueecontent  ~+ l3 x- ~& M2 o7 R- |/ g0 K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, B/ I; l2 A: L, j
}- e5 s" C" A9 w3 e/ n5 Q
else if (document.layers){6 f4 a# o2 ~! D! v# r) c
ns_marquee=document.ns_marquee.document.ns_marquee2. t8 u$ _/ h* [( d
ns_marquee.left=marqueewidth+8' E) F4 p- o9 D2 b. f4 f$ X8 t+ v' \
ns_marquee.document.write(marqueecontent)# w# e  r, \' x1 |
ns_marquee.document.close(). Z% l4 Y! }$ s3 e9 s) _
actualwidth=ns_marquee.document.width
1 R( \! h7 j0 q1 U}
8 |5 t6 f: O- v! S$ r9 |lefttime=setInterval("scrollmarquee()",20)
% B  N4 H0 f6 i4 W" L- O}- N" d) r& p! d  I
window.onload=populate
( }' b' B, f7 n2 k; O5 e- m' g% w
) U. i- u6 w- l2 \8 B7 }' x1 e1 i9 O( Kfunction scrollmarquee(){0 k0 L2 ^& B3 |2 k3 A
if (iedom){
: O/ t" X1 V  c$ T6 rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, g6 k4 C/ ]0 e4 L5 Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! |6 Y5 N; Z$ n: G6 L+ B9 Z: u+ e
else, f$ a1 Q0 ]8 r; u% h  {; }, O2 x
cross_marquee.style.left=marqueewidth+8
* V( @" ^* M* j
3 z! _- H7 ]5 G: r& D}0 w; S4 P' |- N+ [8 b: F
else if (document.layers){# m6 v7 c8 k" |7 m5 x$ s# o
if (ns_marquee.left>(actualwidth*(-1)+8))8 H: Z* I! P$ V/ X- i* }
ns_marquee.left-=copyspeed
& d% N1 M( Z$ E1 i* K! d& Celse4 O5 [# \' ~. n" f3 s
ns_marquee.left=marqueewidth+8
+ b. B6 g4 }: i3 _5 ~' K* e}
- H8 q6 @+ w& C0 V}
/ q0 d% n  H) D) ^1 p% I2 B# b4 B( [. L" _9 M5 s+ P
if (iedom||document.layers){
: M% U0 `' \9 Iwith (document){
7 U; G. G/ f' B- j/ z, [* a3 sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ s6 _2 X0 y+ m1 T7 c: f6 hif (iedom){
7 f) H; Y* }. ^, I1 b7 o- Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 @2 l- A7 b  v- b$ Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 Z! Y9 [* j" F# W5 fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 T: ]' J3 U  T" [; lwrite('</div>')
* k- i; O8 X7 ^* a( f9 D}* G4 i5 `5 g. r" [
else if (document.layers){
' b( ]$ F3 @& c( u* ]1 }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: A" d6 t/ O1 v( |6 J8 Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* |. [: f8 i& S$ ^) S4 h! A
write('</ilayer>')
5 d6 [0 Q" \$ f1 D7 Q3 B}
. u, Y) F& Q9 D3 fdocument.write('</td></table>'): |. n. {+ [. F8 b8 b
}
9 _, q' G" P* i! d* W}- C  a5 r& T& R* {
</script>

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