javascript常用对象--Math的用法

来源:互联网 发布:ubuntu空闲分区不可用 编辑:程序博客网 时间:2024/06/06 07:27
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> Math的用法 </TITLE>
  <script>
//alert(Math.PI);
//alert(Math.ceil(3.54));
//alert(Math.floor(3.54));
//alert(Math.round(3.54));


var promote = new Array(3);
promote[0] = "拍卖区又有新货到了,赶快来捡便宜啊......"
promote[1] = "成为会员,马上享受八折优惠,还可以参加抽奖!";
promote[2] = "庆祝访问人数突破十万人次,填问卷就送大奖,快来啊!";


index = Math.floor(Math.random() * promote.length);
document.write(promote[index]);


  </script>


 </HEAD>


 <BODY>
  
 </BODY>
</HTML>
0 0
原创粉丝点击