建了一个login.htm文件,代码如下
<!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>
<title>无标题页</title>
</head>
<body>
<form action="default2.aspx" method ="post" name="Form1" id="Form1">
<table style="width: 368px">
<tr>
<td align="center" style="width: 124px">
用户名</td>
<td align="center" colspan="2">
<input id="text1" type="text" maxlength="50" /></td>
</tr>
<tr>
<td align="center" style="width: 124px">
密码</td>
<td align="center" colspan="2">
<input id="text2" type="password" /></td>
</tr>
<tr>
<td align="center" colspan="3">
<input id="Submit1" type="submit" value="submit" />
<input id="Reset1" type="reset" value="reset" /></td>
</tr>
</table>
</form>
</body>
</html>
再建一个default2.aspx文件,代码如下:
<%@ Page Language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write(Request.Form("text1"))
Response.Write(Request.Form("text2"))
End Sub
</script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div> </div>
</form>
</body>
</html>
现在的问题是login.htm提交后,default2.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>
<title>无标题页</title>
</head>
<body>
<form action="default2.aspx" method ="post" name="Form1" id="Form1">
<table style="width: 368px">
<tr>
<td align="center" style="width: 124px">
用户名</td>
<td align="center" colspan="2">
<input id="text1" type="text" maxlength="50" /></td>
</tr>
<tr>
<td align="center" style="width: 124px">
密码</td>
<td align="center" colspan="2">
<input id="text2" type="password" /></td>
</tr>
<tr>
<td align="center" colspan="3">
<input id="Submit1" type="submit" value="submit" />
<input id="Reset1" type="reset" value="reset" /></td>
</tr>
</table>
</form>
</body>
</html>
再建一个default2.aspx文件,代码如下:
<%@ Page Language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write(Request.Form("text1"))
Response.Write(Request.Form("text2"))
End Sub
</script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div> </div>
</form>
</body>
</html>
现在的问题是login.htm提交后,default2.asp页面上没有任何显示,即数据没有传输过来,很奇怪
action="default2.aspx?id=1"
再在default2.aspx中:
Response.Write(Request.Form["id"]);
干嘛不单独把后台代码放一个文件?
用VS2005直接新建default2.aspx
然后在page_load函数中取值response.write(request.form["id"])或response.write(request.form("id"))
不知道vb是不是和c#一样用的方括号[]