<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>form check</title>
<script>
function xx(){
var form = document.forms['form'];
var file1 = form.elements['file1'];
var file2 = form.elements['file2'];
file1.disabled = true;
file2.value = "xxxx";
file2.focus();
file2.select();
}
</script>
</head>
<body onload=xx()>
<form name="form" action="javascript:alert('Submitted')">
<input type="text" name="file1" onselect=""/>
<br>
<input type="text" name="file2" onchange="alert(this.value)"/>
<br>
<input type="text" name="file3" onchange="alert(this.type)"/>
<br>
<!--当用户再次聚焦此输入框时,内容就已经全部被选中-->
<input type="text" name="file4" onfocus="this.select()"/>
<br>
<textarea onfocus="this.select()"></textarea>
<br>
<input type="submit" value="submit">
<input type="button" value="SoSubmit" onclick="document.forms[0].submit()">
<!--仅提交一次,之后按钮就disable了-->
<input type="button" value="OnlySubmit" onclick="this.disabled=true; this.form.submit()"/>
</form>
</body>
</html>
posted on 2008-05-17 19:26
bcterry 阅读(127)
评论(0) 编辑 收藏