<form id="form1" name="form1" method="post" action="">
<input name="num" type="text" id="num" />
</form>现在要实现的功能,num域本来有个默认数量,如果修改了数量(和以前的数量不一样),失去焦点后,自动提交,不用点提交按钮,如何失现?
<input name="num" type="text" id="num" />
</form>现在要实现的功能,num域本来有个默认数量,如果修改了数量(和以前的数量不一样),失去焦点后,自动提交,不用点提交按钮,如何失现?
<head>
<title></title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<input name="num" type="text" id="num" onchange='change()' value='10'/>
</form>
<script>
function change() {
form1.submit();
}
</script>
</body>
</html>类似这样?
function ss(){
document.forms[0].submit();
}
</script>
</head><body>
<form id="form1" name="form1" method="post" action="">
<input name="num" type="text" id="num" value="1" onchange="ss()"/>
</form>
</body>
</html>
这样?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload = function() {
document.getElementById('num').onchange = function() {
var d = this.value;
if (!/^[0-9\uFF10-\uFF19]+$/.test(d)) alert('非法数据');
else {
d = d.replace(/[\uFF10-\uFF19]+?/g, function(n) {
return String.fromCharCode(n.charCodeAt(0) - 65248);
});
this.value = d;
this.form.submit();
}
}
}
</script>
</head><body>
<form id="form1" name="form1" method="post" action="">
<input name="num" type="text" id="num" />
</form>
</body>
</html>
<input name="num" type="text" id="num" onblur='autosubmit(this)' value='11' />
</form>
<script type='text/javascript'>
function autosubmit(o)
{
if(o.value != o.defaultValue) {
document.getElementById('form1').submit();
}
}
</script>