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
<a onmouseout="mclosetime()" onmouseover="mopen('m2')" id="ctl00_An开发者_JAVA技巧chorText5" 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?
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
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.
精彩评论