返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 \% @9 B" l: Q2 _- Vvar marqueewidth=300
0 E  L* f( F% Q0 v1 t: w1 }- g//高度
, t$ @; [) K2 t5 Z: Fvar marqueeheight=25
& a9 o$ D* y8 d+ t: D//速度(1-10): x& M* A- I' c, @! p8 S, l! [- |
var marqueespeed=3! o; k4 \+ ~1 v- r  S  a
//背景颜色
7 ?, j+ I! I( \* P5 ]var marqueebgcolor="#FFFFFF"* {9 N8 L) B8 H/ L
//是否能暂停 (0=no. 1=yes)?( }: t4 ^) L( T$ j: i& w9 R
var pauseit=1
$ P  F$ l3 h& v& B$ d8 G- U4 C
+ D3 Q  c. s4 p7 i//修改显示内容
& L6 c% [' o: e) O! H" g  Y9 \var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 }# O0 R2 j* M" K7 T6 T, `* j& A
+ y6 N1 \' l- c+ b8 Q  R
& h8 W$ ?% U7 W  H5 k////下面不需改变////////////
! A# p8 d3 L, h- [7 @9 f6 G0 h) K. [. j, x5 [4 c
var copyspeed=marqueespeed
, K; n9 Z$ l5 e$ |! ivar pausespeed=(pauseit==0)? copyspeed: 0" ~9 k8 v% t& @1 g4 @
var iedom=document.all||document.getElementById8 n: m) W* v# K& B! ?0 r
if (iedom)
, [" P3 d5 j3 ~& U6 xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: v7 P3 P2 r) c/ C! rvar actualwidth=''
4 H; W9 d2 @) J$ evar cross_marquee, ns_marquee
8 D! \! K: Y; |4 x: k; w$ G$ f' e
0 l- G6 a" o/ J% x% T3 i  @function populate(){% [( m( i3 e, e1 d3 ~0 d0 z1 `
if (iedom){$ Q$ \2 R! S" L! y: ~8 `+ `/ ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ P: t$ ]2 ^3 V5 I# g' y( ]( h8 Q
cross_marquee.style.left=marqueewidth+8
5 o  y/ q  l+ H0 z$ T- @cross_marquee.innerHTML=marqueecontent. X4 M+ x  r0 O8 o6 ]# F' z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" i0 }# Z+ {2 z7 v+ x
}; k3 @8 W% r, T' Z; G3 A
else if (document.layers){
2 K. F# [, K" o& f6 k, ons_marquee=document.ns_marquee.document.ns_marquee2% G9 u# g, Z. R) p& D
ns_marquee.left=marqueewidth+8
+ M+ Z6 }. Q: a' k6 \* o9 z5 O* Kns_marquee.document.write(marqueecontent)
1 D/ |) z7 c0 M! q+ u/ B5 C: Z0 M% vns_marquee.document.close()$ g5 B* e0 A; P  u2 F8 A
actualwidth=ns_marquee.document.width
* v, U, W; F9 n}
/ D8 Z1 M2 x2 x( {" a- [/ Elefttime=setInterval("scrollmarquee()",20)
. b: i9 L2 w* c, \' H}
* g3 h2 P3 e; g. F0 Zwindow.onload=populate
2 _. N) ^" k. M9 K3 ~, }! {7 d: I4 K: J* n6 y9 S, `" s
function scrollmarquee(){# I' @/ t, |  C; a; O0 }
if (iedom){
0 R; d& f( i: S; _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 y, G' W" I! S) A( jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 @: A( I& o: ]3 P; L6 b2 C3 i! a
else
5 q; w/ O  i& ycross_marquee.style.left=marqueewidth+8
: n" H8 M0 Y* B) K4 x& I' m. W2 N+ n: d
}
4 K9 ?& D* D* P1 J& Aelse if (document.layers){) w4 i. m8 R1 `% I- v
if (ns_marquee.left>(actualwidth*(-1)+8))
- C# R6 r0 r+ n8 N  Hns_marquee.left-=copyspeed
4 B7 P/ i8 D! L  M5 g/ Uelse; T9 |% S; h* P! |
ns_marquee.left=marqueewidth+8+ C6 G$ C7 |/ [% O$ h
}1 ?2 ?" Z0 ]/ V
}
) X4 Q* h1 b  M% K$ Y: D2 W9 A' W2 f
if (iedom||document.layers){
6 s, i  o( c( xwith (document){1 a& b* M! m3 ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- U9 {  g' c) V% s# z- `if (iedom){
2 ]4 C1 A. h5 w; M: Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 F5 N) a+ Z) e2 ~: Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  n* m; Y& x* s) K0 t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' a! {# }; D! b% ewrite('</div>')# r* @- i( r. A7 Q( n
}* ^2 V2 E9 W, _  I. k
else if (document.layers){
- \) V0 n6 ?7 |) b& [+ s6 r! Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# N/ f+ v1 p! w# z3 K0 iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% S! X+ S; K2 F) lwrite('</ilayer>')* w% a  d/ D* y- |0 g( C
}7 e+ n/ b8 X, e& R* ^
document.write('</td></table>'); z( ]( U( w# F7 \
}
6 c0 {7 l- C( U/ z3 _9 z" T}
; x- ~0 t, Y! G3 L) K$ C/ @</script>

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