求对数字进行加减的控件

大虾哥哥 2010-03-02 02:32:58
在浏览起页面上有没有对数字进行加减的控件?请高手给一个。类似于windows的时间编辑页面的图片一样,我们可以直接点击向上,向下的箭头来对年份,月份,等进行增加,减少的操作。
...全文
286 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
千游 2010-03-03
  • 打赏
  • 举报
回复
引用 3 楼 wxg22526451 的回复:
HTML codehead><title>无标题页</title><scripttype="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><divid="ss" style="position:relative; padding:0; height:1.2em; width:100px;border:solid 1px blue;"><inputid="input" value="10" style="height:1em; width:80px; padding: 0 2px; position:absolute;border:0px;"/><ahref="javascript:up();" style="position:absolute; right:0px; border:solid 1px blue; height:0.5em;"><imgsrc="up.jpg" style=" border-width:0px; position:relative;top: -3px; width:20px; height:0.5em"/></a><ahref="javascript:down();" style="position:absolute; right:0px; border:solid 1px blue; bottom:0px; height:0.5em;"><imgsrc="down.jpg" style=" border-width:0px; position:relative;top: -3px;width:20px; height:0.5em"/></a></div></body>

d
wxg22526451 2010-03-03
  • 打赏
  • 举报
回复
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>
zyzy15 2010-03-03
  • 打赏
  • 举报
回复

<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;
}
上海程序员3 2010-03-03
  • 打赏
  • 举报
回复
没有这样的控件,还是建议直接用select控件代替好了。

用程序来代替这样的控件也不太方便,因为输入方式很多,有键盘,有鼠标,有粘贴。
大虾哥哥 2010-03-03
  • 打赏
  • 举报
回复
呵呵。多谢wxg22526451,及zyzy15两位,你们提供的办法,让我的问题解决了。

87,901

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧