获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 N! ~. K# g) E3 O( J% _4 S8 _
var marqueewidth=300
7 B% l! s3 E- h( t) i//高度
' Z! z, i& T2 z( R$ _& E/ y! ]: kvar marqueeheight=25- y! C( p" \- r  {, d
//速度(1-10)
: K- d- O, X8 Uvar marqueespeed=3
9 x% c& Z7 H0 Q2 t' h) v//背景颜色
! q$ R% F, X" Ovar marqueebgcolor="#FFFFFF"
4 |# P$ v, K& p4 ~//是否能暂停 (0=no. 1=yes)?  }7 L/ u: x* _2 U4 J7 D- H" b
var pauseit=1
! @" M5 r. M- Z4 D
" T; A1 Q& b. R( d+ Q//修改显示内容/ I6 g- i7 G! t0 w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- s) }, u: H4 A7 K% e0 p/ v
3 {+ H" F: j+ }, O5 }5 p4 |, F* _

7 j' e# U4 c7 P1 s////下面不需改变////////////& c6 J( [( `7 p, K8 e
2 Z9 F# o: D3 n3 `, M* b
var copyspeed=marqueespeed) d' Q7 K" f9 N9 l: W- a  C/ F
var pausespeed=(pauseit==0)? copyspeed: 0
) x4 N# F- Z8 T' p9 g; B" F9 @3 X0 l7 ?var iedom=document.all||document.getElementById
1 ^  w- |' J8 f* s0 hif (iedom)
, E0 @. P0 I6 C  c& kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), i# }/ V7 r/ \' q: K1 s
var actualwidth='') R( d1 ?  n# Q, Y4 e2 |) ~( L
var cross_marquee, ns_marquee
  [- Y( `6 J% r/ S& m" F- h. ~
- r. X9 r# W! e* k7 x  gfunction populate(){
) w" c6 s2 `2 g, [* i7 |6 Oif (iedom){
- ~. f- U+ E/ Z4 Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 l- M: q! J, L. a$ C; _4 l
cross_marquee.style.left=marqueewidth+8# {+ m( X  \) V* K4 |
cross_marquee.innerHTML=marqueecontent
' C. E' H5 j1 t& Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) a8 f# n5 f( Z) z, z7 R}
* ?/ D  j1 {. m! i9 ]6 d8 Eelse if (document.layers){9 _7 ?/ S. I* P4 S! L
ns_marquee=document.ns_marquee.document.ns_marquee2# c% r# ~3 i+ E
ns_marquee.left=marqueewidth+8
  f, I+ @) l6 o$ Gns_marquee.document.write(marqueecontent)
0 O! |, a) }0 q( P2 a, G0 rns_marquee.document.close()
- I, O$ J) |8 M9 Z2 U6 aactualwidth=ns_marquee.document.width$ ^, @- w- f- r2 _; Z. X: e6 G0 E3 p! ]
}' U6 \& W4 E) {. w  _* F$ X
lefttime=setInterval("scrollmarquee()",20)* {1 o  m& \  u" B6 p; F2 D8 x( b
}/ {8 Z% d' R/ U8 ~2 G- N/ A4 K
window.onload=populate
/ n3 c6 L8 J# \; F0 `: ^8 U
) u0 W# z9 S6 m& }  ifunction scrollmarquee(){8 D/ s9 m0 [" v* c9 {8 U# |
if (iedom){2 _7 A: [5 g. |* _' F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' k4 b$ a! V, j3 zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- m9 s) K8 q0 c  q1 nelse
4 J+ [  Y' j7 Y% v# Wcross_marquee.style.left=marqueewidth+8! F2 C& }3 `% h
& r& E& n* {6 K6 `
}% w8 R* D; t# W* w1 ?- C7 b
else if (document.layers){
. O3 u# t0 O$ p5 D( j% dif (ns_marquee.left>(actualwidth*(-1)+8))
2 p# O' S7 W3 f' Y8 X, w3 |1 Mns_marquee.left-=copyspeed
+ \1 @, x8 ~: S/ welse
5 j; t! G+ U: a% y0 Q0 q# Kns_marquee.left=marqueewidth+8( g* y5 i) p' I& ], J
}
# Y; _- O" `. g}( Q! v+ b$ v' \+ _; F: ^

* z9 G7 \  s8 @  X0 ^  o% Hif (iedom||document.layers){
( [6 {1 W9 D- a: c& {with (document){
/ w8 \2 [) G6 j8 L* Z* e% @# Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); f% w* Y# @$ Y
if (iedom){
# m/ V  i) a9 |" Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 Y5 p" Y2 L8 z1 f% gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 |7 A- n$ R( i8 O5 lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# x+ x- H0 R! G5 B9 Z2 I
write('</div>')
" n# {3 w8 B  k: n! C5 v! r- X! a}
/ G* J" ?. `5 D# n2 Lelse if (document.layers){
5 R. y# I- t( S$ vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! l5 x/ [' U( Y8 y3 m/ {) s5 Y7 ?# owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' w' \" {; ?% O7 J8 [: bwrite('</ilayer>')
" M6 W$ n# p: R5 p}$ h& \! K3 Q" B
document.write('</td></table>')
% v% S; W5 g: G! g}, i) A8 q2 I5 c! s" T$ k4 M9 y$ {
}$ R. b* K  ~, k8 @: a+ N6 [
</script>

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