<body><form name="form1" action="" method="post">患者名字:<input type="text" name="username" value="zhang" /><br /><br /><input type="button" name="ok" value="打印患者信息" οnclick="printPerson()" /><input type="button" name="ok" value="查询患者信息" οnclick="selectPerson()" /></form><script language="javascript">//通过获取JavaScript函数的方式访问printPerson.html和selectPerson.htmlfunction printPerson(){//1:获取表单var form1 = document.form1;//2.设置表单的action属性form1.action="printPerson.html";//3.提交表单form1.submit();}function selectPerson(){//1.获取表单var form1 = document.forms[0];//从0开始,即第一个表单开始//2.设置表单的action属性form1.action="selectPerson.html";//3.提交表单form1.submit();}</script></body>
printPerson.html页面:
<body><p>打印患者信息</p></body>
selectPerson.html页面:
<body><b>查询患者信息</b></body>