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

网页之跑马灯文字特效

//修改宽度
% j" U2 e4 X  Q# A: S1 cvar marqueewidth=300
7 ~3 ]5 i* h. S0 J+ v//高度5 a  A. x/ z6 _! o
var marqueeheight=251 ?, J, c% q  P$ B- ~: z
//速度(1-10)
0 v. N% T/ W8 V4 r: l2 R( J7 Jvar marqueespeed=3* m. n/ s4 b- Q' }! Q
//背景颜色. B+ J& e4 d* U6 f1 `
var marqueebgcolor="#FFFFFF"
- u4 z0 l4 p" a//是否能暂停 (0=no. 1=yes)?
# f- Q3 e% X0 U4 I0 Qvar pauseit=1
+ m$ O6 m$ B& H- Y4 M) ^. @, L; _! J' G+ Y' _* [+ R. [( @0 ]
//修改显示内容
2 b# W+ E  x8 Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ U: q4 U" Z" J* }8 V5 {" D
, g3 O) e0 T. `2 m: I/ u1 H" r" r* g1 ~5 e: s2 [
////下面不需改变////////////
& I. }! R8 F4 e5 B. a- d/ J$ u# z) L( ~+ R
var copyspeed=marqueespeed6 V5 p& `4 X" q& c8 t2 v  w, {
var pausespeed=(pauseit==0)? copyspeed: 06 [) `" v% V) T, c# O; g
var iedom=document.all||document.getElementById6 x% @( e# `9 b7 x
if (iedom)6 A6 h- P4 H7 H- Q6 s7 c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 P3 [# ~0 W+ f6 |( b! y  Qvar actualwidth=''7 r3 E6 D; ^7 ]7 e( p
var cross_marquee, ns_marquee" j% I' ^' E/ {: D# W
9 m" V- Z- Q# i; Q
function populate(){1 L) K( \- |, A5 k) j; c  a
if (iedom){" l7 s& Q, ^0 q* f' A/ q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 {+ e% m$ b: D0 {
cross_marquee.style.left=marqueewidth+8
; I) n9 {( C+ t. B! ]2 L* }cross_marquee.innerHTML=marqueecontent1 _) t$ y( e9 t1 G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' i7 e4 {8 h: b" [4 z/ y7 n
}
7 q6 }4 |. O  ?( P+ q* aelse if (document.layers){
8 s" |+ ^/ b" u# j. @' q  Ens_marquee=document.ns_marquee.document.ns_marquee2( r: j, a& v0 U- K- Y" o
ns_marquee.left=marqueewidth+8
5 l9 y' ?  T' x3 v  z/ a6 v% a/ Tns_marquee.document.write(marqueecontent)
$ V' _. M3 P% I6 M+ f0 Ins_marquee.document.close()) s. V9 o9 n" g4 M: g: Q
actualwidth=ns_marquee.document.width
* o  A$ H9 C! ?( c9 ~9 M}
: v4 a; _& N5 A  C+ E( \" Ylefttime=setInterval("scrollmarquee()",20)
- J  {2 k6 w) g- _}
) w, s. ?) O7 f( q7 fwindow.onload=populate) Q# O- B3 [- B3 h- u
* s4 y1 e" d/ Q+ f  E
function scrollmarquee(){. e* r2 j5 R  [2 p% O, ^* B
if (iedom){
' u/ v5 v2 Y: N0 ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ j% o) ?6 E$ A4 T* _; Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) l" h! {) Y' K1 _5 F" v
else/ h2 p  D- m; W& Y6 r
cross_marquee.style.left=marqueewidth+8; @4 N, w% M/ Y# x  o9 j) y

1 F) z  _0 w2 u. I}  n" [  s( a$ [9 }7 c
else if (document.layers){' X2 k* G1 m5 [) k  r0 R3 y
if (ns_marquee.left>(actualwidth*(-1)+8)); r7 \# N/ Y1 D
ns_marquee.left-=copyspeed3 X# l- {4 w6 x7 M0 s2 R) K
else
" O# r% B' }+ g/ G! M0 E2 Dns_marquee.left=marqueewidth+8
1 d$ q4 s6 J0 @* A}
: ^+ `; {( T9 V4 ]( l7 R0 U0 b6 u7 @}4 {; h- u0 g: t8 I; u! [' g

* `( K2 M% ^0 iif (iedom||document.layers){: B2 g6 I9 T$ [4 n4 C' X0 k4 X+ G
with (document){
8 Z! P5 [: H5 `% rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' g0 E" X0 v- t. f( \  K) b
if (iedom){
. ]7 B1 h2 g$ \, p6 e& \. {& ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! Z! p8 T, ]6 b+ }, Z6 @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# n) W1 V& H- ?( o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 F) {& D- E" G; hwrite('</div>')" S1 H/ @# L5 ^8 s2 v
}
) z  [, V# q$ {2 f+ d8 D- R6 u7 ~else if (document.layers){
! x. Y  z' r3 _2 k2 Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( K. H8 k$ W5 E+ h% d/ Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- A0 @/ |* V: p  Lwrite('</ilayer>'); {2 U' [' `$ _3 ^
}% S( _+ x3 q" Z) ~% U' `+ G
document.write('</td></table>')  C- \) q7 W2 Z! ]( a3 O& b
}
8 o9 d" j* r% A}
& J* D! y4 b! t0 b</script>

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