<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<script type="text/javascript">
<!--
function sum(sign){
var oval = document.getElementById("oval");
if(sign == '-'){
oval.value = parseInt(oval.value) - 1;
}else{
oval.value = parseInt(oval.value) + 1;
} }
//-->
</script>
</head> <body>
<input type="button" value=" - " onclick="sum('-')" /><input type="text" id="oval" value="100" /><input type="button" value=" + " onclick="sum('+')"/>
</body>
</html>
解决方案 »
- JS在指定范围点击时刷新页面
- 首页添加如下JS文件,作用是什么?
- refresh问题
- 如何像lightbox弹出图片一样弹出网页?
- 怎么对<Select>对象的<option>进行排序
- 函数内怎样调用自己
- var global = (function () { return this || (1, eval)('this'); }())这个怎么理解?
- 请问那位现成的javascript工具条,最好解决了div透明
- 关于IE的问题
- 急救!请教如何通过applet实现网上历史曲线功能,类似股票行情的东东!!!!!!!!!!!
- JS 动态生成表 后 ONCLICK事件的问题
- JS 动态建生成表格,添加事件的问题
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<script type="text/javascript">
<!--
function sum(sign){
var oval = document.getElementById("oval");
if(sign == '-'){
oval.value = parseInt(oval.value) - 1;
}else{
oval.value = parseInt(oval.value) + 1;
} }
//-->
</script>
</head> <body>
<input type="button" value=" - " onclick="sum('-')" /><input type="text" id="oval" value="100" /><input type="button" value=" + " onclick="sum('+')"/>
</body>
</html>
这个是对的