简体   繁体   English

Anchor Tag自己获得href

[英]Anchor Tag get href by itself

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 但当我运行应用程序并呈现页面时,锚标记包含href地址

<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/#" 我也尝试从后面的代码设置“#”,但它再次显示href =“../ masterpages /#”

can anyone know how to solve this problem? 任何人都知道如何解决这个问题?

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: 在客户端查看id似乎就像A标签被声明为页面上的控件一样,原始语句中没有显示,请尝试使用它并查看它是否适合您:

<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 我已经测试了你的A链接代码,它按预期工作,所以你可能有一些改变你的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. 我建议仔细检查你是否用手编码了这个href而没有使用插入工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM