首页 > 编程 > HTML > 正文

利用HtmlGenericControl类,动态改变Title文字

2024-08-26 00:15:33
字体:
来源:转载
供稿:网友


htmlgenericcontrol类可以创建服务器端控件,以映射到相应的html元素,而不被.net框架类所转换。比如<body><span>等。下面的例子就是利用htmlgenericcontrol类动态创建title元素的。

changepagetitle.aspx

<%@ page language="vb" autoeventwireup="false" codebehind="changepagetitle.aspx.vb"
inherits="aspxweb.mengxianhui.com.changepagetitle"%>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title id="mypagetitle" runat="server"></title>
<meta name="code_language" content="visual basic 7.0">
<meta name="vs_defaultclientscript" content="javascript">
<meta name="vs_targetschema" content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body ms_positioning="gridlayout">
<form id="form1" method="post" runat="server">
</form>
</body>
</html>

changepagetitle.aspx.vb

public class changepagetitle
inherits system.web.ui.page

protected mypagetitle as new htmlgenericcontrol()

private sub page_load(byval sender as system.object, _
byval e as system.eventargs) handles mybase.load

mypagetitle.innertext = "【孟宪会之精彩世界】之.net开发者乐园"

end sub

end class
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表