欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
  我们来看具体的代码
 
  PostForm.html
 
  
 
  
 
  <!DOCTYPEhtml>
 
  <html>
 
  <head>
 
  <metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
 
  <title></title>
 
  </head>
 
  <body>
 
  <formmethod="post"action="PostDest.aspx">
 
  <div>Value-01<inputname="value01"type="text"/></div>
 
  <div>Value-02<inputname="value02"type="text"/></div>
 
  <div>Value-03
 
  <selectid="Select1"name="value03">
 
  <option>元素1</option>
 
  <option>元素2</option>
 
  <option>元素3</option>
 
  <option>元素4</option>
 
  <option>元素5</option>
 
  </select>
 
  </div>
 
  <div>Value-04<br/>
 
  <inputid="Radio1"name="RadioGroup1"type="radio"/><labelfor="Radio1">单选按钮元素1</label><br/>
 
  <inputid="Radio2"name="RadioGroup1"type="radio"/><labelfor="Radio2">单选按钮元素2</label><br/>
 
  <inputid="Radio3"name="RadioGroup1"type="radio"/><labelfor="Radio3">单选按钮元素3</label><br/>
 
  </div>
 
  <div>Value-05<br/>
 
  <inputid="Chkbox1"name="checkbox1"type="checkbox"/><labelfor="Checkbox1">检查项目1</label><br/>
 
  </div>
 
  <div>Value-06<br/>
 
  <inputid="Hidden1"name="hiddenfield1"type="hidden"value="TestValue"/><br/>
 
  </div>
 
  <inputtype="submit"value="POST"/>
 
  </form>
 
  </body>
 
  </html>
 
  说明:
 
  带有HTML的form标签的表单。通过设置method=“post”来POST表单数据。POST的目标URL由action=“PostDest.aspx”指定。如果未指定,将对同一URL执行POST。
 
  服务器端
 
  服务器端接收POSTed数据并将其显示,下面使用ASP.NET来构建它。
 
  PostDest.html
 
  
 
  <%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="PostDest.aspx.cs"Inherits="HtmlForm.PostDest"%>
 
  <!DOCTYPEhtml>
 
  <html>
 
  <headrunat="server">
 
  <metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
 
  <title></title>
 
  </head>
 
  <body>
 
  <formid="form1"runat="server">
 
  <div>
 
  <asp:LabelID="Label1"runat="server"Text="Label"></asp:Label>
 
  </div>
 
  </form>
 
  </body>
 
  </html>
 
  PostDest.aspx.cs
 
  
 
  usingSystem;
 
  usingSystem.Collections.Generic;
 
  usingSystem.Linq;
 
  usingSystem.Web;
 
  usingSystem.Web.UI;
 
  usingSystem.Web.UI.WebControls;
 
  usingSystem.IO;
 
  namespaceHtmlForm
 
  {
 
  publicpartialclassPostDest:System.Web.UI.Page
 
  {
 
  protectedvoidPage_Load(objectsender,EventArgse)
 
  {
 
  StreamReaderreader=newStreamReader(Request.InputStream);
 
  stringstr=reader.ReadToEnd();
 
  reader.Close();
 
  Label1.Text=str;
 
  }
 
  }
 
  }






本文转载自中文网

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html5/h54324.shtml