如何更改点击时的超链接 NavigteURL

发布于 2024-08-16 23:32:45 字数 446 浏览 7 评论 0原文

众所周知,超链接有一个 navigationURL 属性,每当您单击超链接时,您都会重定向到链接目标,这是可以的。

因此,LinkBut​​ton 在视觉情况下与 Hyperlink 相同,但它没有 navigatorURL 属性,而是您可以通过在 LinkBut​​ton 的 OnClick 事件上使用 Response.Redirect 来重定向用户,这三种

方法之间的区别在于 HyperLink 能够打开目标 URL新的浏览器选项卡或新页面,但 linkBut​​ton 只是在当前打开的窗口中重定向用户。

你可以使用 javascript 通过 window.opn 打开一个窗口,但我需要的是使用一个超链接,通过用户选择的项目的组合生成他的目标 URL(这对于超链接是不可能的,但可以通过 LinkBut​​ton 实现)

任何时候生成 NavigatURL 的想法用户在选择项目之前非静态地单击链接

As you all know, HyperLink have a navigateURL property and whenever you click on a hyperlink you'll redirect to link destination, it is ok.

So LinkButton in visual cases are same as Hyperlink but it have not a navigateURL property and instead you can redirect user by using Response.Redirect on OnClick event of LinkButton,

the differet between thee mehods are that HyperLink has the ability to open the destinatio URL on a new browser tab or a new page, but linkButton just redirect user in current open window.

you can open a window by window.opn with javascript butall I need is use a HyperLink that generate his destination URL by a composition of user selected Items ( this is not possible with hyper link but is available with LinkButton)

any Idea to generate NavigatURL whenever User clicks on the link not staticly before selecting Items

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

懒的傷心 2024-08-23 23:32:45

通过执行 Response.Redirect(""); 单击链接按钮可以触发重定向。您可以存储要重定向到的 URL 作为按钮的命令参数...超链接是一个链接,您可以处理客户端点击,但最简单的可能是创建您自己的链接...我不确定您正在寻找的最终解决方案是什么?

您希望能够在服务器上处理点击然后重定向吗?如何生成 URL?您始终可以通过执行以下操作来更改 JS 中链接的 href:

var a = document.getElementById("linkid");
a.href = "http://hewlink.com";

A link button can trigger a redirect when its clicked by doing Response.Redirect(""); you can store the URL to redirect to as the command argument of the button... A hyperlink is a link, and you can handle client-side clicks, but easiest may be to create your own links... I'm not sure what the final solution you are looking for is?

Do you want to be able to process the click on the server and then redirect? How do you generate the URL? You can always change the href of a link in JS by doing:

var a = document.getElementById("linkid");
a.href = "http://hewlink.com";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文