返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% ^, @& w$ S/ |7 cvar marqueewidth=300% \9 ]9 t) D4 }7 O( @* H# ^% E8 C: T
//高度
8 a, ?( ]; e  w0 L& n3 [var marqueeheight=25
' Z0 Q1 k& X# n- X3 e+ T//速度(1-10)
: N7 K8 \) }1 V" H3 Evar marqueespeed=3
9 l, A* Z+ s* |4 V! S//背景颜色
" N+ L; t9 a) G8 z0 jvar marqueebgcolor="#FFFFFF"
" A# n$ r; ?- J( s( W/ q6 g//是否能暂停 (0=no. 1=yes)?
( K1 C8 s) K0 e5 {0 m6 n& Gvar pauseit=1$ p) O3 `1 H1 g$ k

4 R* M: k# ^9 @2 b//修改显示内容1 j% A* F; E! y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! H9 o5 S6 O; F0 x6 O

, {. K( X5 G: W# h, x. I& `& ~4 [& J. ~) D7 d% v" F, l- N
////下面不需改变////////////  R8 y% Q( {& Z- `
% ]6 J0 q2 ^- O6 c) }& a- L1 @
var copyspeed=marqueespeed
- a- |; M+ U' Fvar pausespeed=(pauseit==0)? copyspeed: 04 t" t# C0 ]# f5 N
var iedom=document.all||document.getElementById& L7 k5 c+ K5 C4 X! q
if (iedom)
. \7 ~9 k% n' ~! d/ Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 Q0 K8 w2 ?; I( p7 U1 c  W
var actualwidth=''
, ~# x4 _2 N) i( s! r6 ]var cross_marquee, ns_marquee7 B" j6 r1 O, T* G' q
$ T) T8 O( @( [. H: o1 `; j, ]
function populate(){' m3 `% |! K# Z  [' a5 R8 J
if (iedom){$ y! F- a" K5 F! k. a& d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# |! d% ]" I3 Lcross_marquee.style.left=marqueewidth+8
+ R# p, U* ~: e. V  ]0 ~& v' Ucross_marquee.innerHTML=marqueecontent
4 |& R4 O, V" J# B$ Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& n+ h4 w4 i* Y% W}9 O. _0 Z, b( d( o  t; b) |  b& ?& k
else if (document.layers){1 q  M& Z" R1 p- s
ns_marquee=document.ns_marquee.document.ns_marquee2+ l9 z0 F0 u  U, j# Q/ H
ns_marquee.left=marqueewidth+84 P/ }; G0 e8 d( z; T9 ]1 Y7 ], `3 |
ns_marquee.document.write(marqueecontent)
3 h6 ]2 l* T" w& ?ns_marquee.document.close()& @& o: s7 V7 E# U
actualwidth=ns_marquee.document.width
$ r" O4 j) K( L7 D+ N) W/ Y4 X}
( R& R. s' s1 k9 l3 _lefttime=setInterval("scrollmarquee()",20)4 Y$ _! ~3 N: _: n
}$ V* q9 w8 H8 J, y
window.onload=populate
& y/ ]& c6 i: I  r, P2 G' }% l2 n8 S4 t
function scrollmarquee(){
9 U  h) m7 ~" g& Aif (iedom){
/ u8 ~0 Q/ F1 o6 j/ h5 F5 i# l: }) S3 ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 u+ _. L/ ^; d% U0 i9 G2 C: T  Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 F& o1 Z$ V( d7 E
else9 X7 g& @6 I5 k5 |) [
cross_marquee.style.left=marqueewidth+8& Y5 q5 s/ `4 _9 S
3 r$ F3 v+ Q& X: K: A: ?/ `0 l$ r
}( H0 A; P& h& ^7 D: ]
else if (document.layers){
# @4 |# b: s% p2 n8 Kif (ns_marquee.left>(actualwidth*(-1)+8))
: B' `$ i0 v- U/ P. l. p+ Lns_marquee.left-=copyspeed% p* R& i" B5 y
else) K" D; ^- w9 D; ]$ S
ns_marquee.left=marqueewidth+8: [) T/ `# Y: k, F  i
}
6 W6 J7 ]: P; Q" z2 F" ]4 C1 v}! v7 C- X! z* }9 B

# W! w1 S4 I5 ~1 ?/ f# Zif (iedom||document.layers){
, e" ]+ }. ^% k1 xwith (document){
  \3 f  G  B" q. s0 h& F" Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 H1 h8 I) p+ H7 _* B* M
if (iedom){4 o- V* L" w; w# `9 c- R& [8 H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), C- q3 b6 C: m: B( T" {; m) ^4 f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' {: n6 Z, {7 e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% C' {8 q9 G3 l; G7 q6 n3 Fwrite('</div>')1 |1 d# E: d& E4 P
}
  S- Q3 E( Y2 Qelse if (document.layers){7 \0 s) r9 Q% w, D% C7 z7 U0 ?: Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 u5 [# l" n0 {- r6 e  p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& v# p; s1 S; \0 C( kwrite('</ilayer>')
/ m2 ]' O0 o+ P+ H}2 r) p, o% d  x5 c) N2 E
document.write('</td></table>')! |) b' T8 B" J; d& y
}* E# u+ [8 O, u: k$ g8 a
}
# f2 d) X2 ^0 D, c: }+ N</script>

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