求对数字进行加减的控件 在浏览起页面上有没有对数字进行加减的控件?请高手给一个。类似于windows的时间编辑页面的图片一样,我们可以直接点击向上,向下的箭头来对年份,月份,等进行增加,减少的操作。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 没有这样的控件,还是建议直接用select控件代替好了。用程序来代替这样的控件也不太方便,因为输入方式很多,有键盘,有鼠标,有粘贴。 <TABLE cellpadding=0 cellspacing=0> <TR> <TD rowspan=2><INPUT TYPE="text" NAME="inp" value="0" onfocus="this.blur()"></TD> <TD><INPUT TYPE="button" VALUE="^" ONCLICK="doit(1)" style="width:20;height:10"></TD> </TR> <TR> <TD><INPUT TYPE="button" VALUE="ˇ" ONCLICK="doit(-1)" style="width:20;height:10"></TD> </TR> </TABLE> function doit(para){ var num = parseInt(inp.value); inp.value = num + para; } head> <title>无标题页</title> <script type="text/javascript"> function up() { var t=document.getElementById("input").value; document.getElementById("input").value=parseInt(t)+1; } function down() { var t=document.getElementById("input").value; document.getElementById("input").value=parseInt(t)-1; } </script></head><body><div id="ss" style="position:relative; padding:0; height:1.2em; width:100px;border:solid 1px blue;"> <input id="input" value="10" style="height:1em; width:80px; padding: 0 2px; position:absolute;border:0px;" /> <a href="javascript:up();" style="position:absolute; right:0px; border:solid 1px blue; height:0.5em;"> <img src="up.jpg" style=" border-width:0px; position:relative;top: -3px; width:20px; height:0.5em" /> </a> <a href="javascript:down();" style="position:absolute; right:0px; border:solid 1px blue; bottom:0px; height:0.5em;"> <img src="down.jpg" style=" border-width:0px; position:relative;top: -3px;width:20px; height:0.5em" /> </a></div></body> 呵呵。多谢wxg22526451,及zyzy15两位,你们提供的办法,让我的问题解决了。 为什么input里计算的结果会是这样? js二级联动小问题 在框架页中如何使另一个框架的页面刷新(含参数) 鼠标移动到文本框 弹出颜色代码器? 可不可以按回车后使图片链接的页面提交 window.open问题 怎么判断一个Function是否存在 请教关于input框赋值的问题 在Dreamweaver使用层覆盖不了表单中的列表控件,怎么办? easyui url 多参数动态参数传递,求助!!! 正则表达式,匹配两字符间的字符串,包括换行 [吐血推荐]Ajax从入门到精通!!
<TABLE cellpadding=0 cellspacing=0>
<TR>
<TD rowspan=2><INPUT TYPE="text" NAME="inp" value="0" onfocus="this.blur()"></TD>
<TD><INPUT TYPE="button" VALUE="^" ONCLICK="doit(1)" style="width:20;height:10"></TD>
</TR>
<TR>
<TD><INPUT TYPE="button" VALUE="ˇ" ONCLICK="doit(-1)" style="width:20;height:10"></TD>
</TR>
</TABLE> function doit(para){
var num = parseInt(inp.value);
inp.value = num + para;
}
<title>无标题页</title>
<script type="text/javascript">
function up()
{
var t=document.getElementById("input").value;
document.getElementById("input").value=parseInt(t)+1;
}
function down()
{
var t=document.getElementById("input").value;
document.getElementById("input").value=parseInt(t)-1;
}
</script>
</head>
<body>
<div id="ss" style="position:relative; padding:0; height:1.2em; width:100px;border:solid 1px blue;">
<input id="input" value="10" style="height:1em; width:80px; padding: 0 2px; position:absolute;border:0px;" />
<a href="javascript:up();" style="position:absolute; right:0px; border:solid 1px blue; height:0.5em;">
<img src="up.jpg" style=" border-width:0px; position:relative;top: -3px; width:20px; height:0.5em" />
</a>
<a href="javascript:down();" style="position:absolute; right:0px; border:solid 1px blue; bottom:0px; height:0.5em;">
<img src="down.jpg" style=" border-width:0px; position:relative;top: -3px;width:20px; height:0.5em" />
</a>
</div>
</body>