返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' k' x% M2 L& K1 n9 t' Yvar marqueewidth=300
! s% l" P, E0 J6 K//高度
; t/ \! _: u* U2 @8 tvar marqueeheight=25
' c, h; c3 U0 W% Y2 V//速度(1-10)4 u- o% Z+ U: ]" n; `
var marqueespeed=3
% K/ o* g4 H: a) H0 i) ^//背景颜色8 A2 G1 |# ]0 e+ q* [
var marqueebgcolor="#FFFFFF"
9 Z1 N$ E  W5 y/ E. {4 E% Z: ?//是否能暂停 (0=no. 1=yes)?5 h3 x8 f; y6 `  }
var pauseit=1
4 e( J- C! p! ^2 ^; V) b3 S9 E6 S3 B' B
//修改显示内容
2 Z# b* U& A$ ~* D: s6 ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ ]% K1 Q) ]- E% C$ X$ X3 V1 g

+ V* R, s3 ]# B# [
" [" I1 i7 G! m( {* Q////下面不需改变////////////
0 h* \- V* l; J. n6 @" |$ M: q7 P
4 w" S, _4 k. V! C3 \; Jvar copyspeed=marqueespeed
1 ~6 v6 p4 m* z! [+ M7 Vvar pausespeed=(pauseit==0)? copyspeed: 00 `  n! t$ S! N8 ?% y( \
var iedom=document.all||document.getElementById5 ^; R/ x# G! [
if (iedom)- a, v+ I% E( a8 ^+ a' F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* r: o" Y- P( N  D  f
var actualwidth=''
) V% g. v" G" |var cross_marquee, ns_marquee
6 Z# N& b' {5 w+ e( Z6 T1 J3 j1 W9 E: J
function populate(){! K/ J! D. H4 B5 u+ }. d
if (iedom){# M8 v5 k: {% k/ {4 G1 W  }; S$ t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 q! i3 f- d2 Mcross_marquee.style.left=marqueewidth+8
# j5 f* g" @9 K$ }cross_marquee.innerHTML=marqueecontent! p3 a$ k# Z; i, q9 [0 d2 M4 p& k& L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 d3 a5 H1 ^2 B: m. t! j7 c}4 p8 Z% }: x3 l2 ^  {
else if (document.layers){
5 C' U& w) m& J5 N# F1 S( lns_marquee=document.ns_marquee.document.ns_marquee27 \. _6 H5 W" G7 V
ns_marquee.left=marqueewidth+8
* b& |; T5 {7 K# n; ins_marquee.document.write(marqueecontent)3 ^* D) v. B$ _! ?/ [. W
ns_marquee.document.close()
* v5 Z) [0 |* X) [/ B# e4 bactualwidth=ns_marquee.document.width
9 q6 P" v# E: V, O- q: z  G) o}
9 x0 Q. O* m0 g# ~lefttime=setInterval("scrollmarquee()",20)/ r( W8 M6 \* a' N
}; l, \, q, k0 O1 }' M4 J
window.onload=populate! s" d5 H% c4 z: I  w5 c% t

# u& t+ B6 D' ]% ?! Efunction scrollmarquee(){
1 N/ _+ n/ {! D* Dif (iedom){% U7 V) K% b; z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( o/ v$ P8 @; ?& O/ Q4 r5 fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& X! |) N7 E4 u& d7 zelse0 c4 H# Y; C' H4 I  }; s* ~
cross_marquee.style.left=marqueewidth+8
" h, ^' ^3 a5 Y. A# Q  ~- J: k: a* Z" I! U4 Y: c; b
}
3 S7 _' n5 P0 ]/ i" Xelse if (document.layers){7 w" _5 S5 L+ ?0 ^2 w, ^
if (ns_marquee.left>(actualwidth*(-1)+8))
8 Z9 t/ a9 G$ q/ Jns_marquee.left-=copyspeed/ a1 x9 `" N/ q9 x# _0 s
else+ d+ {: h% m' u
ns_marquee.left=marqueewidth+8
4 F8 u8 l3 |% K}
8 e4 C" P' X+ l1 N% u; L: r}; v, E: n6 `' m5 M# C9 W
6 \$ R( ?) b6 H2 L
if (iedom||document.layers){
6 }7 c  @' h3 _; wwith (document){
8 O2 B2 e' y0 t2 Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  h) D- {7 o% _* {' p/ G; z
if (iedom){3 [8 H7 @3 |1 m1 B1 X( |! S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ _6 O, v& m1 h8 O0 u& k7 F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); A' r9 O  S; M( J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 N3 v7 r; e4 i$ f* |- y6 v! wwrite('</div>')
. k2 Y9 @8 U+ L4 F4 ]}
0 E; O& ^% K$ Y- J* @- }' g: pelse if (document.layers){
. z, m; x" B  Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- L" K4 F  ?! t; Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 H& K( K8 H. |3 Wwrite('</ilayer>')8 x& Z. T( f0 j$ I* F
}
0 X8 n9 f8 R, N8 B6 p8 z8 {document.write('</td></table>')
5 L3 {4 M5 A2 _5 e9 b& x}
# u8 j9 I7 W: ^}6 E8 h- g5 v( W: U. F
</script>

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