返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 G- V0 M/ C2 @, r+ \) s$ S
var marqueewidth=300
3 p: c8 E& d7 F/ _4 _  @2 z//高度
- [; y. f6 A7 @6 B& o( Hvar marqueeheight=25* [' x- r! N. G/ x% A& `
//速度(1-10)" D9 t3 M% O  Q/ C( n
var marqueespeed=3
: N1 u) L5 l& R! N2 S7 q6 t//背景颜色
% Z* I' m. ^0 r7 Y8 nvar marqueebgcolor="#FFFFFF"
0 t1 `4 B: k5 _+ e//是否能暂停 (0=no. 1=yes)?1 p( W$ I- `3 U  E0 y+ e8 V1 ~# A% s. ~
var pauseit=1
/ H3 @4 y5 I0 I6 }
: O! {  _7 M! p//修改显示内容
& [$ Q! H+ S2 l% f& hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 u" m- |0 @5 b$ ~  g- l2 Q: L. m/ M7 a
2 h% }3 S( U3 \' t9 W2 ~
////下面不需改变////////////
0 ?' J% Y0 z3 l& ]4 w9 j4 ^5 Z: e& X- W6 B
var copyspeed=marqueespeed" Z$ r9 r$ I2 t* q
var pausespeed=(pauseit==0)? copyspeed: 0
5 _. }$ ~4 N0 J: g0 jvar iedom=document.all||document.getElementById% B  {4 j: d: T- P% y
if (iedom)
  k* Y  k( x6 l5 Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( c- Z3 |- c' Q( M+ ]/ b1 [var actualwidth=''
4 V6 [! F' ]# v3 Ivar cross_marquee, ns_marquee9 [% e! J2 {/ L- Y

4 C) o" V9 b/ d& [& S8 kfunction populate(){
% K% w4 s9 ~' ?: I+ I* g, yif (iedom){
1 g/ e2 Z+ G0 Q% v# U, Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) [* b4 }4 z2 u' Ucross_marquee.style.left=marqueewidth+8
) |3 n( l( w- E. c6 L. Across_marquee.innerHTML=marqueecontent
% f9 h* {$ F) @) m* C& [+ i# }4 dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: i3 K6 k' a5 f
}& B+ s/ O: F) X# Y) u
else if (document.layers){* X$ c2 P. e1 X, e% n; O. }, |
ns_marquee=document.ns_marquee.document.ns_marquee2) t+ Y9 [. k! _1 D- [8 G4 x# v2 E
ns_marquee.left=marqueewidth+8
* j5 X# z5 C$ X; m! sns_marquee.document.write(marqueecontent)
0 V1 q% X% _% ?$ C6 |- Q- d: Ans_marquee.document.close()! d' n0 V. ]" z8 U& x. I
actualwidth=ns_marquee.document.width3 Z% h; M9 ~# G& d
}: ]. C, M9 ?! H* y, f& ~
lefttime=setInterval("scrollmarquee()",20)2 B4 |( d4 t$ X# J; T. H1 d& o6 n
}
! f" \' U* B: d- O" J" n# S0 i# lwindow.onload=populate
! M! o& ]3 H+ X5 E: k1 t' J& S- P( x$ k4 ~/ N; ]
function scrollmarquee(){# J0 E; v2 h8 H  ~. y5 g+ c
if (iedom){
3 A+ M2 p' E* L4 hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 H# \: L; p( Z" c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 a7 |' F, {! y6 z/ n8 K& ?3 Nelse
+ s1 O* G( S/ i+ B. B+ H* S- icross_marquee.style.left=marqueewidth+8
9 c; O; \* r" n6 h9 o3 j9 Y" W# `7 V5 `. ?8 a
}& O0 I3 f- ~% i6 v0 o4 G
else if (document.layers){- A. I! z- n8 M
if (ns_marquee.left>(actualwidth*(-1)+8))6 |, @0 n( H. q/ q& D
ns_marquee.left-=copyspeed7 F  K% o& }7 l7 d
else
! k( G; K. Z8 s. R% W4 @7 }ns_marquee.left=marqueewidth+85 F, L. z9 |. x# b3 P; E+ C4 S1 w
}
- i+ W% n6 K- A- w- J" e, d7 O}
+ _. A( k1 i0 B0 n0 }4 O$ ]
' G/ D: q, t& A6 cif (iedom||document.layers){
' F4 {3 W" r& @2 C1 Bwith (document){
0 q3 B% j/ D0 s7 ?- I6 K4 _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 ]5 B! }6 W. e& b5 s
if (iedom){
& L* {' U7 D9 f! R" H  f" J. Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 ?: w' I% G( c' I  n( T4 n/ L. X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 [+ V  P: g: {. |7 x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' j8 W: O( Q( f. \, R# ?. ^
write('</div>')& Y. M2 X0 s0 B# D% c7 V3 a& f
}4 g& ~, [! F% G4 X: q5 c! K6 O
else if (document.layers){7 g6 Z, b: _+ o+ O, E# d* A0 V  I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): R) \" H- b& A2 ^  w$ I1 F% Z6 s3 W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 h# r% C* |% M2 u: W& U9 Swrite('</ilayer>')
- B# x/ Z9 n, b. z- R' J5 l}# m( H1 ]& Z3 ?; C! h& D
document.write('</td></table>')
* P" p7 L8 q7 r) U}
& u- q! k- \. X5 S8 k3 l$ x- p}9 B, z% T) v2 r. S8 E
</script>

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