简体   繁体   中英

Setting page title through javascript

How do I set this page Title through javascript

<head runat="server">
    <link href="../App_Themes/CSS/Catalyst.css" rel="stylesheet" type="text/css" />
    <title><asp:Literal ID="ltlTitle" runat="server"></asp:Literal>
        </title>
</head>

You can just do something like,

<script type="text/javascript">    
  document.title = "This is the new page title.";

  //or 

 $(document).attr('title', 'test');
</script>

you can check by the following code:

document.title="My Title by Vaibhav";
document.write(document.title);

采用

$('title').html("new title");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM