1.form 中的嵌套
问题:不认识第一个form,抛出缺少对象。

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function test(formName) {
 var theForm = document.getElementById(formName);
 alert(theForm.name);
}
</script>
</head>

<body>
<form name="searchForm">
 <form name="1Form">
 </form>
 <form name="2Form">
 </form>
 <form name="3Form">
 </form>
 
 <input type="button" name="other" value="提交1Form" onClick="test('1Form');" />     
 <input type="button" name="sub" value="提交2Form" onClick="test('2Form');" />
 <input type="button" name="main" value="提交3Form" onClick="test('3Form');" />
 <input type="button" name="main" value="提交searchForm" onClick="test('searchForm');" />
</form>

</body>
</html>