asp中联动表单的js 中form与页面form嵌套,如何解决

时间:2022-09-12 13:21:23
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "css/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/teaIndex.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<SCRIPT language=JavaScript>
<!--
var groups=document.fileUpload.Itype.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("1")
group[1][0]=new Option("2")
group[2][0]=new Option("3")
group[3][0]=new Option("4")
group[4][0]=new Option("5")
group[5][0]=new Option("6")
group[6][0]=new Option("7")
group[7][0]=new Option("8")
group[8][0]=new Option("9")
group[9][0]=new Option("10")
group[10][0]=new Option("11")
group[11][0]=new Option("12")
group[12][0]=new Option("13")
var temp=document.fileUpload.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}

//-->
</SCRIPT>
<!--#include file="conn.asp"-->
<%
if request("action")="teaReg" then
set rs=server.createobject("adodb.recordset")
rs.open "select * from Director  where id ='"&trim(request("id"))&"'",conn,1,3
if rs.recordcount>0 then
response.write "<script language='javascript'>window.alert('您输入的用户名已存在,请返回重新输入!');history.back(-1);</script>"
response.end
end if
sql="select * from Director" 
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3 
rs.addnew
dim xuhao

rs("id")=trim(request.form("id"))
rs("Password")=trim(request.form("Pass")) 
rs("Name")=trim(request.form("Name"))
rs("Group")=trim(request.form("Group")) 
rs("groupid")=trim(request.form("groupid")) 
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript> alert('注册成功,点击确定立即登录!');location.replace('index.html');</script>"
response.end
end if
%>
<title>导师注册界面</title>
<!-- InstanceEndEditable -->
<title>物理与电子工程学院论文导师选报系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rel="stylesheet" href="images/top.css" type="text/css" />
<link rel="stylesheet" href="images/font.css" type="text/css" />
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body>
<div align="center">
  <table width="100%" height="126" border="0" cellpadding="0" cellspacing="0">
<tr>
          <td width="887" height="58" align="center" valign="bottom">
      <p><img src="images/logo.jpg" width="550" height="58" align="top" /></p></td>
    </tr>
        <tr>
          <td height="34" align="center" valign="top" bgcolor="#003300">
            <table width="600" height="34" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td>
                  <ul id="mbmcpebul_table" class="mbmcpebul_menulist css_menu" style="width: 795px; height: 45px;" >             
                      <li class="topitem spaced_li"><div class="buttonbg"><a href="teaSearch.asp">导师及研究方向</a></div></li>
                      <li class="topitem spaced_li"><div class="buttonbg" style="width: 126px;"><a href="teaMod.asp">修改个人信息</a></div></li>
                      <li class="topitem spaced_li"><div class="buttonbg" style="width: 126px;"><a href="teaInfo.asp">查看个人信息</a></div></li>
                      <li class="topitem"><div class="buttonbg"><a href="unload.asp">注销并返回主页</a></div></li>
                  </ul></td>
            </tr>
          </table></td>
    </tr>
        <tr>
          <td height="34" align="center" valign="top"><!-- InstanceBeginEditable name="EditRegion3" --> 
  <div>
     <Form name="form1" method="post" action="?action=teaReg" onsubmit="return chkform(this)">
     <table width="760" height="298" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#d4e4f6">
<tr>
                <td height="224" align="left" valign="middle"><table width="500" height="270" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td height="42" colspan="2" align="center"><span class="AllFont">请输入注册信息:</span></td>
                  </tr>
                  <tr>
                    <td width="198" height="42" align="right" class="AllFont">登录账号:</td>
                    <td align="left" class="AllFont">        <input name="id" type="text" class="AllFont" id="id" size="20" /></td>
                  </tr>
                  <tr>
                    <td width="198" height="42" align="right" class="AllFont">密码:</td>
                    <td align="left" class="AllFont"><input name="Pass" type="password" class="AllFont" id="Pass" size="20" /></td>
                  </tr>
                  <tr>
                    <td width="198" height="42" align="right" class="AllFont">姓名:</td>
                    <td align="left" class="AllFont"><input name="Name" type="text" class="AllFont" id="Name" size="20" /></td>
                  </tr>
                  <tr>
                    <td width="198" height="42" align="right" class="AllFont">研究所:</td>
                    <td align="left" class="AllFont">
<FORM name="fileUpload">
<SELECT name="Itype"onchange="redirect(this.options.selectedIndex)" size=1>
                        <option>理论物理</option>
                        <option>粒子物理与原子核物理</option>
                        <option>原子与分子物理</option>
                        <option>凝聚态物理</option>
                        <option>光学与光电信息工程</option>
                        <option>物理学科教育</option>
                        <option>材料物理</option>
                        <option>计算材料设计</option>
                        <option>物理电子学</option>
                        <option>电路与系统</option>
                        <option>电气工程</option>
                        <option>实验中心</option>
                        <option>河南省光伏材料重点实验室</option>
                        </SELECT> 
<SELECT name="stage2" size=1>
                              <option selected="selected">1</option>
</SELECT>
</FORM>                          
</td>
                  </tr>
                  <tr>
                     <td height="35" colspan="2" align="center"><input name="submit" type="submit" class="Font1" value="注册" />
                     &nbsp;
 <input name="submit" type="reset" class="Font1" value="重置" /> </td>
                     <td height="35" align="center">&nbsp;</td>
                  </tr>
              </table></td>
       </tr>
            </table></Form>
<!-- InstanceEndEditable --></td>
    </tr>
  </table>
</div> 
</body>
<!-- InstanceEnd --></html>

3 个解决方案

#1


form会刷新页面,你的联动菜单用form干什么?
应该用AJAX才行。

#2


FORM提交完就刷新ASP没法吧。只能ONBUER填写触发

#3


哪位大神可以帮助修改一下,真的不会

#1


form会刷新页面,你的联动菜单用form干什么?
应该用AJAX才行。

#2


FORM提交完就刷新ASP没法吧。只能ONBUER填写触发

#3


哪位大神可以帮助修改一下,真的不会