string pagePath = " MCDEX时讯 > " + list[i].c_issue+ " > " + list[i].c_category + " > " + list[i].c_name; Page.RegisterStartupScript("1", string.Format("<script>parent.TopFrame.onSetPagePath(true,'{0}');parent.TopFrame.setTitle('{1}');</script>", pagePath, list[i].c_name));
想在 pagePath 里 list[i].c_issue
添加链接怎么添加啊?
直接加不行整个都不出啦O(∩_∩)O~!
想在 pagePath 里 list[i].c_issue
添加链接怎么添加啊?
直接加不行整个都不出啦O(∩_∩)O~!
1,看客户端的html里面生成的
<script>parent.TopFrame.onSetPagePath(true,'{0}');parent.TopFrame.setTitle('{1}');</script>
是否正确2,打印
pagePath, list[i].c_name
分别是什么特别注意
list[i] 里面的i,难道是要输出多行的js?
或者
Page.RegisterStartupScript("1", string.Format("<script>parent.TopFrame.onSetPagePath(true,\"{0}\");parent.TopFrame.setTitle(\"{1}\");</script>", pagePath, list[i].c_name));
ClientScript.RegisterStartupScript(this.GetType(), "", javaScript);
Page.ClientScript.RegisterStartupScript(this.GetType(),"",string.Format(" parent.TopFrame.onSetPagePath(true,'{0}');parent.TopFrame.setTitle('{1}')", pagePath, list[i].c_name),true);跟Page.ClientScript.RegisterStartupScript
还是Page.RegisterStartupScript没有关系看你的数据是
{
string tempContent = list[i].m_content.Replace(" ", " ").Replace("\r\n", "<br />");
if (list[i].i_title_seqno == 1)
{
pArtTitle.InnerHtml = string.Format("{0}</br>({1})</br>{2}", list[i].c_name, list[i].c_issue, list[i].c_datetime.ToString("yyyy-MM-dd"));
string pagePath = " MCDEX时讯 > " + list[i].c_issue+ " > " + list[i].c_category + " > " + list[i].c_name; Page.RegisterStartupScript("1", string.Format("<script>parent.TopFrame.onSetPagePath(true,'{0}');parent.TopFrame.setTitle('{1}');</script>", pagePath, list[i].c_name));
}
sb.AppendFormat("<div class=\"ParTitle\">{0}</div>", list[i].c_title);
sb.AppendFormat("<div class=\"ParContent\"><p>{0}</p></div>", tempContent);
}
pArtContent.InnerHtml = sb.ToString();
}
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
String[] link = { "http://dotnet.aspx.cc", "http://dotnet.aspx.cc", "http://dotnet.aspx.cc" };
String[] title = { "我的站点", "孟宪会", ".NET 学习" };
string pagePath = " MCDEX时讯 >";
for (int i = 0; i < link.Length; i++)
{
if (i == link.Length - 1)
{
pagePath += " <a href='" + link[i] + "'>" + title[i] + "</a>";
}
else
{
pagePath += " <a href='" + link[i] + "'>" + title[i] + "</a> > ";
}
} Page.ClientScript.RegisterStartupScript(Page.GetType(), "m", "SetTitle(\"" + pagePath + "\")", true); }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript"> function SetTitle(s) {
document.getElementById("x").innerHTML = s;
} </script>
</head>
<body>
<form id="form1" runat="server">
<div id="x">
</div>
</form>
</body>
</html>
看明白方法了吧