<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="js/jquery-1.7.2.js" ></script>
<style>
input{
width: 25px;
}
li{
list-style: none;
}
</style>
</head>
<body> <ul>
<li>
<div>java</div>
<div style="display: inline-block;">
单价:<span id="price_store1" style="margin: 20px;">50.00</span>
库存:<span id="java_store1" style="margin: 20px;">100</span>
</div>
<div style="display: inline-block;">
<button id="store1">-</button>
<input type="text" id="input_store1" value="0" />
<button id="_store1">+</button>
</div>
</li>
<li>
<div>Javascript</div>
<div style="display: inline-block;">
单价:<span id="price_store2" style="margin: 20px;">30.00</span>
库存:<span id="java_store2" style="margin: 20px;">100</span>
</div>
<div style="display: inline-block;">
<button id="store2">-</button>
<input type="text" id="input_store2" value="0" />
<button id="_store2">+</button>
</div>
</li>
<li>
<div>MyQSL</div>
<div style="display: inline-block;">
单价:<span id="price_store3" style="margin: 20px;">60.00</span>
库存:<span id="java_store3" style="margin: 20px;">100</span>
</div>
<div style="display: inline-block;">
<button id="store3">-</button>
<input type="text" id="input_store3" value="0" />
<button id="_store3">+</button>
</div>
</li>
<li>
<div>Oracle</div>
<div style="display: inline-block;">
单价:<span id="price_store4" style="margin: 20px;">55.00</span>
库存:<span id="java_store4" style="margin: 20px;">100</span>
</div>
<div style="display: inline-block;">
<button id="store4">-</button>
<input type="text" id="input_store4" value="0" />
<button id="_store4">+</button>
</div>
</li>
<li>
<div>jQuery</div>
<div style="display: inline-block;">
单价:<span id="price_store5" style="margin: 20px;">40.00</span>
库存:<span id="java_store5" style="margin: 20px;">100</span>
</div>
<div style="display: inline-block;">
<button id="store5">-</button>
<input type="text" id="input_store5" value="0" />
<button id="_store5">+</button>
</div>
</li>
<li>
<div>html</div>
<div style="display: inline-block;">
单价:<span id="price_store6" style="margin: 20px;">15.00</span>
库存:<span id="java_store6" style="margin: 20px;">100</span>
</div>
<div style="display: inline-block;">
<button id="store6">-</button>
<input type="text" id="input_store6" value="0" />
<button id="_store6">+</button>
</div>
</li>
</ul>
<li>
总计:<span id="qty_store">0</span>件商品
总价:<span id="total_store">0</span>元
</li> </body>
<script>
$.each($("input"), function(i,n) {
n.disabled = "disabled";
});
var bt = $("button");
$("button:even").on('click',function(){
$("#java_" + this.id).text(parseInt($("#java_" + this.id).text()) + 1);
$("#input_" + this.id).val(parseInt($("#input_" + this.id).val()) - 1);
$("#qty_store").text(parseInt($("#qty_store").text()) - 1);
$("#total_store").text(parseInt($("#total_store").text()) - parseInt($("#price_" + this).text())); });
$("button:odd").on('click',function(){
$("#java" + this.id).text(parseInt($("#java" + this.id).text()) - 1);
$("#input" + this.id).val(parseInt($("#input" + this.id).val()) + 1);
$("#qty_store").text(parseInt($("#qty_store").text()) + 1);
$("#total_store").text(parseInt($("#price" + this.id).text()) + parseInt($("#total_store").text()));
});
</script>
</html>

最新文章

  1. ios语音输入崩溃
  2. Grandle全局变量定义及引用
  3. 深入JVM-垃圾收集器常用的GC参数
  4. java中byte数据转换为c#的byte数据
  5. 【SNMP】Linux系统下安装net-snmp
  6. AndroidApplication Fundamentals(Android应用基础)
  7. echarts 折线柱形上方显示自定义格式数据
  8. glsl-UBO
  9. 读取XML文件的几种方式的效率分析
  10. 让2个并列的div根据内容自动保持同等高度js
  11. Apache Ranger对HDFS的访问权限控制的原理分析(一)
  12. bs4模块
  13. pycharm的list中append的应用
  14. .NET [MVC] 利用特性捕捉异常
  15. 如何在Eclipse中Debug调试Java代码
  16. Oracle12c 从入门到精通(第二版) 闫红岩 金松河 编著
  17. sharepoint2013 Restore-SPSite 报错,采用数据库还原
  18. python笔记9-字符串操作
  19. Java实现用汉明距离进行图片相似度检测的
  20. ISO8601时间格式

热门文章

  1. ASP.NET错误处理的方式(一)
  2. MySQL提权之user.MYD中hash破解方法
  3. iOS中 Proxy和的delegate区别
  4. JS数据模板分离(告别字符串拼接)-template
  5. BZOJ 1562 变换序列 二分图匹配+字典序
  6. Django F对象的使用
  7. bbs论坛浏览器兼容性问题
  8. mysql备份数据库脚本
  9. 浏览器打印不出div背景颜色
  10. Epoll为我们带来了什么