关于动态修改html中的某些内容
解决方法:
例如,改变页面的title
1)
<script language =javascript >
window.document.title =tl;
</script>
.cs中:
string s="123456";
Response.Write("<script language=javascript>var tl='"+ s +"'</script>");
2)
<title><%=s%></title>
.cs中:
public string s="123456";
使用protected修饰也行,但internal修饰则出错,???
3)
<title><%=Method()%></title>
.cs中:
public string Method()
{
return "123456";
}
同二,使用internal修饰也不行???
本文介绍了三种在ASP.NET中动态修改HTML页面标题的方法。第一种是通过JavaScript直接修改document.title属性;第二种是在ASP.NET中使用<%= %>语法将变量直接插入<title>标签;第三种则是调用一个返回字符串的方法来动态生成<title>标签的内容。
5068

被折叠的 条评论
为什么被折叠?



