form、method、action、onsubmit、onreset、onchange、select、form.name.
<!DOCTYPE html>
<html lang="zh" id="htmlId">
<head id="headId">
<title>BOM基础</title>
<meta charset="utf-8">
<meta name="keywords" content=",,">
<meta name="description" content="">
<style>
form p{
display:inline;
}
</style>
</head>
<script type="text/javascript">
function check(form){
var span = document.getElementById("sname");
var txt = form.username.value;
if(txt == "")
{
span.innerText="填写姓名"
form.username.focus();
return false;//提交事件的特殊之处。
}
return true;
}
function resetFun(form){
return false;
}
function selectChange(value,selectedIndex)
{
alert(value+selectedIndex);//弹出“中国0”、“英国1”,“美国2”,“deguo3”
}
function formsClick(){
var theform = document.forms[1];
theform.username.value="theButton";
alert(theform);
}
function funChange(obj){
//text input的内容发生改变,且失去焦点
alert(obj.value);
}
function documentAll(){
var arryy = document.all[0];
alert(arryy);
}
</script>
<body id="bodyId">
<form method="post" action="%E5%B7%A5%E8%B5%84%E6%9D%A1.html" οnsubmit="return check(this)" οnreset="return resetFun(this)">
姓名:<input type="text" name="username"><span id="sname"></span>
<input type="submit" value="提交">
<input type="reset" value="重置">
<input type="text" name="textInput" value="容发生改变,且失去焦点时调用" οnchange="funChange(this)">
</form>
<form>
<select οnchange="selectChange(this.value,this.selectedIndex)">
<option>中国</option>
<option>英国</option>
<option>美国</option>
<option value="Germany">德国</option>
</select>
<input type="button" value="document" οnclick="documentAll()">
<input type="button" name="username" value="name=username" οnclick="formsClick()">
<input type="button" value="name!=username" οnclick="formsClick()">
</form>
</body>
</html>