码迷,mamicode.com
首页 > 编程语言 > 详细

javascript 小例子(待补充)

时间:2014-06-03 03:13:19      阅读:284      评论:0      收藏:0      [点我收藏+]

标签:c   class   blog   code   java   a   

<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script>
		function figure1(){
			var figure = money.value;
			var wushi = Math.floor(figure/50);
			var ershi = Math.floor(figure%50/20);
			var shiyuan = Math.floor(figure%50%20/10);
			var wuyuan = Math.floor(figure%50%20%10/5);
			var yiyuan = Math.floor(figure - wushi*50 - ershi*20 - shiyuan*10 - wuyuan*5); 
			//alert(figure);
			show.innerHTML = figure+"="+"50:"+wushi+"  20:"+ershi+"  10:"+shiyuan+"  5:"+wuyuan+"  1:"+yiyuan;
		}
	</script>
</head>
<body>
	<form action="">
		找零金额:<input type="text" name="money" id="money"><br>  
		<input type="button" value="计算金额" onclick="figure1()">  
	</form>	
	<p id="show"></p>
</body>


bubuko.com,布布扣

javascript 小例子(待补充),布布扣,bubuko.com

javascript 小例子(待补充)

标签:c   class   blog   code   java   a   

原文地址:http://blog.csdn.net/qilixiang012/article/details/27580173

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!