主题:请问一个关于提交表单的问题。
请问各位高手一个问题,用这段JAVA语句是不是不能提交表单信息
<script language="javascript">
<!--
function button1_onclick (){
window.location.href = "register.asp"
}
-->
</script>
是不是按钮的属性必须是Submit提交到另外一张页面才能获得信息。
高手请指教。
全部代码如下:
第一张页面
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn/conn.asp"-->
<!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 button1_onclick (){
window.location.href = "sub.asp"
}
-->
</script>
</head>
<%
dim slt1,slt2
slt1=request.form("slt1")
slt2=request.form("slt2")
set rs=server.CreateObject("adodb.recordset")
set rs1=server.CreateObject("adodb.recordset")
sql="select * from gk"
rs.open sql,conn,1,1
sql1="select * from saler_type where type1='"&slt1&"'"
rs1.open sql1,conn,1,1
%>
<body>
<form id="form1" name="form1" method="post" action="">
<label>
<select name="slt1" id="slt1" onchange="javascript:form1.submit();">
<option>请选择发布栏目</option>
<%do while not rs.eof%>
<option><%=rs("name")%></option>
<%rs.movenext
loop%> </select>
</label>
<label>
<select name="slt2" id="slt2">
<%do while not rs1.eof%>
<option><%=rs1("type2")%></option>
<%rs1.movenext
loop%>
</select>
</label>
<label>
</label>
<label>
<input type="button" name="Submit" value="按钮" name=button1 onclick=button1_onclick()>
</label>
</form>
</body>
</html>
第二张页面:
<!--#include file="conn/conn.asp"-->
<%
dim slt2
slt2=request("slt2")
set rs=server.CreateObject("adodb.recordset")
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from saler_type where type2='"&slt2&"'"
response.Write sql1
response.End()
rs1.open sql1,conn,1,1
type1=rs1("type1")
type2=rs2("type2")
sql="insert into salers(saler_type1,saler_type2) values('"&type1&"','"&type2&")"
response.Write sql
response.End()
rs.open sql,conn,1,1
%>
<script language="javascript">
<!--
function button1_onclick (){
window.location.href = "register.asp"
}
-->
</script>
是不是按钮的属性必须是Submit提交到另外一张页面才能获得信息。
高手请指教。
全部代码如下:
第一张页面
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn/conn.asp"-->
<!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 button1_onclick (){
window.location.href = "sub.asp"
}
-->
</script>
</head>
<%
dim slt1,slt2
slt1=request.form("slt1")
slt2=request.form("slt2")
set rs=server.CreateObject("adodb.recordset")
set rs1=server.CreateObject("adodb.recordset")
sql="select * from gk"
rs.open sql,conn,1,1
sql1="select * from saler_type where type1='"&slt1&"'"
rs1.open sql1,conn,1,1
%>
<body>
<form id="form1" name="form1" method="post" action="">
<label>
<select name="slt1" id="slt1" onchange="javascript:form1.submit();">
<option>请选择发布栏目</option>
<%do while not rs.eof%>
<option><%=rs("name")%></option>
<%rs.movenext
loop%> </select>
</label>
<label>
<select name="slt2" id="slt2">
<%do while not rs1.eof%>
<option><%=rs1("type2")%></option>
<%rs1.movenext
loop%>
</select>
</label>
<label>
</label>
<label>
<input type="button" name="Submit" value="按钮" name=button1 onclick=button1_onclick()>
</label>
</form>
</body>
</html>
第二张页面:
<!--#include file="conn/conn.asp"-->
<%
dim slt2
slt2=request("slt2")
set rs=server.CreateObject("adodb.recordset")
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from saler_type where type2='"&slt2&"'"
response.Write sql1
response.End()
rs1.open sql1,conn,1,1
type1=rs1("type1")
type2=rs2("type2")
sql="insert into salers(saler_type1,saler_type2) values('"&type1&"','"&type2&")"
response.Write sql
response.End()
rs.open sql,conn,1,1
%>