0

应用程序是.Net。我想记录对超链接的点击。很容易。我将其更改为链接按钮,现在可以执行所需的服务器端代码来记录点击。问题是:现在我无法启动指向 _blank 目标的链接。我想吃我的蛋糕,也想拥有它。服务器端代码和 _blank 目标。怎么做?

4

1 回答 1

0

您可以使用:ClientScriptManager.RegisterStartupScript 方法(类型、字符串、字符串)

例如。:

// Define the name and type of the client scripts on the page.
String csname1 = "PopupScript";
Type cstype = this.GetType();
// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = Page.ClientScript;
StringBuilder cstext1 = new StringBuilder();
cstext1.Append("<script type=text/javascript>window.open(url, '_blank') </");
cstext1.Append("script>");
cs.RegisterStartupScript(cstype, csname1, cstext1.ToString());
于 2013-03-21T11:53:32.443 回答