也就是说如何做一个变量,应用到网页标题中。

解决方案 »

  1.   

    Page.Title
    js
    document.title
      

  2.   

        protected void Page_Load(object sender, EventArgs e)
        {
            string strTitle = "变量";
            Page.Title = strTitle;
        }
      

  3.   

    public string title;<title><%= title%></title>
      

  4.   

    using System;
    using System.Web;
    using System.Web.UI;
     
    public partial class _Default : System.Web.UI.Page
    {    public string strTitle = "这就是变量";
    }
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!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><%= strTitle %></title>
     
    </head>
    <body>
        <form id="form1" runat="server">
        </form>
    </body>
    </html>