css&javascript 試做aspx傳值及接收

自已傳自已,由於內容簡單,就不贅述
直接貼上程式碼





網頁的原始碼:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RR.aspx.cs" Inherits="MyAspWeb.RR" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <!-- asp的預設就是用post自已傳自已,action="RR.aspx" method="post"-->

        <p><input type="text" id ="LoginName" name="LoginName" value="" required placeholder="請輸入帳號" title="請在此輸入帳號"/></p>
        <p><input type="password" id ="Password" name="Password" value="" required placeholder="請輸入密碼" title="請在此輸入密碼"/></p>
        <p><input type="submit" value="送出"/> <input type="reset" value="清空" /></p>
        <p> </p>
        <p>帳號:<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></p>
        <p>密碼:<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label></p>
    </form>
</body>
</html>




網頁的程式碼:
        protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Text = Request.Form["LoginName"];
            Label2.Text = Request.Form["Password"];
        }

留言

熱門文章