锚标记自己获取href

发布于 2024-10-21 22:12:12 字数 415 浏览 1 评论 0原文

我在母版页中设置锚标记,

<a onmouseout="mclosetime()" onmouseover="mopen('m2')" id="AnchorText5" href="#">TEst</a>

但是当我运行应用程序并渲染页面时,锚标记包含 href 地址,就像

<a onmouseout="mclosetime()" onmouseover="mopen('m2')" id="ctl00_AnchorText5" href="../MasterPages/#">TEst</a>

我也尝试从后面的代码设置“#”,但它再次显示 href="../masterpages/#"

谁能知道如何解决这个问题?

i set anchor tag in masterpage as

<a onmouseout="mclosetime()" onmouseover="mopen('m2')" id="AnchorText5" href="#">TEst</a>

but when i run application and it render the page the anchor tag contain href address like

<a onmouseout="mclosetime()" onmouseover="mopen('m2')" id="ctl00_AnchorText5" href="../MasterPages/#">TEst</a>

i also try to set the "#" from code behind but it again show href="../masterpages/#"

can anyone know how to solve this problem?

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

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

发布评论

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

评论(2

携余温的黄昏 2024-10-28 22:12:12

查看客户端的id,似乎A标签被声明为页面上的控件,这在原始声明中没有显示,尝试使用它并看看它是否适合您:

<asp:HyperLink id="AnchorText5" runat="server" onmouseout="mclosetime();"
               onmouseover="mopen('m2');" NavigateUrl="#">Test</asp:HyperLink>

我也测试了您的 A 链接代码,它按预期工作,因此您可能会改变您的 href 的行为

looking at the id on the client side it appears to be as if the A tag was declared as a control on the page, which is not shown on the original statement, try using this and see if it works for you:

<asp:HyperLink id="AnchorText5" runat="server" onmouseout="mclosetime();"
               onmouseover="mopen('m2');" NavigateUrl="#">Test</asp:HyperLink>

I have tested your A link code as well and it works as expected, so you might have something changing the behaviour of your href

油焖大侠 2024-10-28 22:12:12

它会抓取它所在的文件夹 URL,具体取决于您导入标签的方式,它很可能会自动定向到该位置。就像您单击“插入__”并抓取桌面上的文件夹一样。它将附加一个额外的块以正确导航。我建议仔细检查您是否已手动编码此 href 并且未使用插入工具。

It's grabbing the folder url that it resides in, depending on the way you have imported the tag it's most likely automatically being directed to that location. Like when you click "Insert __" and grab the folder on your desktop. It will append an extra chunk to navigate properly. I would suggest double checking that you have coded this href by hand and not used a tool for an insert.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文