返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 T2 _. v0 a/ C6 _5 O. C( K$ K6 }var marqueewidth=300# E- h: y7 k* r1 A2 f$ u$ S
//高度
! X0 Y/ Q/ ?$ L+ B' K' C! dvar marqueeheight=25
! G) f: T. T# c# m9 @//速度(1-10)3 x9 v5 f5 `% F: w8 T$ ~4 Y; I
var marqueespeed=3
$ [! y/ p& a1 c2 k! v//背景颜色
9 ^8 u  M$ U! k  x! {, M% ~var marqueebgcolor="#FFFFFF"  Z3 x: W9 S. w2 {5 W9 l3 r
//是否能暂停 (0=no. 1=yes)?% U% j. B( L7 L0 c" W" R
var pauseit=1
: v+ v% A9 r  b5 e
& l& E  H# L8 t8 {1 `- ?. |//修改显示内容
- H9 b% h6 }/ z4 r( o0 B' i" uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 f0 \& A6 s8 T6 _( m. Z$ r- \& U# z( f4 Z

4 U. H$ @' ]9 j  I; S" t////下面不需改变////////////
  E0 g& h( Y0 B! ^  k' q1 L- l, S! h0 t; d
var copyspeed=marqueespeed8 [7 J1 c5 M) K* F' _) B! J
var pausespeed=(pauseit==0)? copyspeed: 0
9 h3 z: D1 s: yvar iedom=document.all||document.getElementById! s: Y! R- R6 n
if (iedom)6 {6 h& B" M* M7 u' x9 `$ G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, w" Y% @0 x% W5 W5 N+ Zvar actualwidth=''2 G5 w$ k) V' ?1 G2 n8 b
var cross_marquee, ns_marquee
+ ?4 `. s/ N) i
6 L8 T+ s# O% Lfunction populate(){
" n, q7 _) _, a+ q  t: X* _7 J& bif (iedom){
) j4 L* A5 ^/ e" m  @1 G* N: q" w; ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: d1 L1 p, g' B! @3 ?! _
cross_marquee.style.left=marqueewidth+8$ Z) ?- q' I' I5 v" l
cross_marquee.innerHTML=marqueecontent
: U+ K) a8 b5 T8 [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 t* D! }) y; Y, d
}' n3 }* F- a" h+ q- e2 @# W
else if (document.layers){% x9 S2 \4 {# B
ns_marquee=document.ns_marquee.document.ns_marquee26 M  ^  x0 c# O1 ?% j* s
ns_marquee.left=marqueewidth+8! u( X$ J' `2 Y& c7 C
ns_marquee.document.write(marqueecontent)5 Y: O- Z) ^& ^3 u# N$ r
ns_marquee.document.close()6 `( R( t  ^3 S
actualwidth=ns_marquee.document.width
# d- F2 x. H* {" n- Z}' t3 W  p  h1 ~( K: H5 O$ _1 @
lefttime=setInterval("scrollmarquee()",20)
' p7 ?1 }  ^6 q- L0 T1 F}
* z& v: V# Y' u: K9 c' T: fwindow.onload=populate% K& @2 y, g1 M/ _' z
4 Z0 f% R) G2 q: P$ C: G5 W! I" K) R
function scrollmarquee(){
  K- Z6 U( H2 m% N: `9 a/ e: s8 P* Vif (iedom){
( R/ }6 T! J& \$ P  x  Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 C  m4 h" ?2 I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: M+ A" w! G' J% G2 q* i
else
6 w  Q/ b+ }/ w3 Y- [& X' Jcross_marquee.style.left=marqueewidth+8
9 H* H1 O" ~' G8 q9 P2 p
6 U1 H; n" |( T0 f4 g}' d& M! X( E' m" i5 K. K
else if (document.layers){7 J3 y1 H2 O5 }1 s: h
if (ns_marquee.left>(actualwidth*(-1)+8))- w! A, O! u( u5 }4 o
ns_marquee.left-=copyspeed. }) K3 i3 g* b" o
else
2 w. u8 B. f+ {: c! h% d4 ]. X- Q4 s  Sns_marquee.left=marqueewidth+8
7 S* k/ s. O! V: {8 [" d0 @% Q+ s}
7 E2 T/ ~* a7 A" P% ]) [8 k}
6 b6 |! [5 k' j3 c) S8 L8 U2 m4 m  s" ]  O
if (iedom||document.layers){& B) E- V- g2 w1 L& ?- ?
with (document){9 o% o! i* ]! y( \  g* t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 }6 h: a4 t: D, @3 d* p
if (iedom){
; r% h) B1 m2 x' zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 a# x- F" {1 i$ Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) T6 ~% x0 s) O- ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ u* O* ^% T# p- ]8 f/ ^( g& _
write('</div>'): T5 h0 c% ~% p& }3 f  {. R- n
}+ a; ?& Z! g, {2 A
else if (document.layers){
  G1 W& A5 H) I# Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 h3 X* q5 N' K4 o: Q3 ?/ E8 Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) J, X; j" L1 `! {' X$ ^write('</ilayer>')
2 e; e/ w6 o: [6 Z}
2 F- N/ J5 G' y% D) q" \document.write('</td></table>'): E; h6 {% }( Q+ F' o) ^; S
}
; R& T6 t4 `4 V; s}
/ F9 ]9 p! p- y6 U) ^" B" L+ d</script>

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