68-100 超連結 動態修改網站
阿新 • • 發佈:2021-12-14
前端和HTML差不多
只是這個叫做asp.net
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DeWeb07.aspx.cs" Inherits="asp.netTest.Demo01.DeWeb07" %> <!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 runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <%--/ 單選按鈕--%> <asp:RadioButton ID="RadioButton1" runat="server" GroupName="gender" Text="男" /> <asp:RadioButton ID="RadioButton2"runat="server" GroupName="gender" Text="女" /> <br /> <%-- 超連結控制元件--%> <asp:HyperLink ID="HyperLink1" NavigateUrl="http://www.xiketang.com" runat="server">這個是超連結控制元件</asp:HyperLink> <br /> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /> </div> </form> </body> </html>
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace asp.netTest.Demo01
{
public partial class DeWeb07 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
this.HyperLink1.NavigateUrl = "https://ke.qq.com";
this.HyperLink1.Text = "開啟西課堂機構官網";
}
}
}
效果