实现数字加减
2016-12-08 14:31
176 查看
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body>
<div class="spinner">
<input type="text" readonly="readonly" value="1" id="t1" />
<div class="arrow"><a onclick="addminus('t1')">+</a><a onclick="addminus('t1', true)">-</a></div>
</div>
<script>
function addminus(id, add) {
var t = document.getElementById(id),
v = parseInt(t.value) || 0;
add ? v++ : v--;
if(v>=0){
t.value = v;
}
}
</script>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body>
<div class="spinner">
<input type="text" readonly="readonly" value="1" id="t1" />
<div class="arrow"><a onclick="addminus('t1')">+</a><a onclick="addminus('t1', true)">-</a></div>
</div>
<script>
function addminus(id, add) {
var t = document.getElementById(id),
v = parseInt(t.value) || 0;
add ? v++ : v--;
if(v>=0){
t.value = v;
}
}
</script>
</body>
</html>
相关文章推荐
- js金额数字格式化实现代码(加减逗号处理)
- jQuery实现数字加减效果汇总
- Js中实现日期加减--字符串转换成数字进行运算
- python实现输入数字的连续加减方法
- jQuery实现购物车数字加减效果
- 十个数字不同,实现加减乘。暴力枚举法
- 实现大数字加减。
- 实现点击加减数字进行变化
- jQuery实现数字加减效果汇总
- 单片机:按键(使用中断)控制数码管的数字加减(c语言实现)
- python实现输入数字的连续加减
- 4个独立按键实现对数码管数字显示的加减清零等
- 大数字的加减乘法实现
- js金额数字格式化实现代码(加减逗号处理)
- jQuery实现购物车数字加减效果
- 安卓点击加减号实现数字加减功能
- 数字加减控件实现
- jQuery实现购物车数字加减效果
- .Net/C#/VB/T-SQL/Java 实现: 将天文数字转换成中文大写 (2000 年前的思路,打劫的,一点儿技术含量都没有)
- 使用C#实现阿拉伯数字到大写中文的转换-第二种方法