href 不返回任何内容?
我的项目的模块文件夹中有一个用户控件。我有一个像这样的链接 在此控件中进行测试。当我将鼠标悬停在页面上的“测试”上时,我可以看到整个网址,例如“www.example.com\projectName\Modules”。但我想让它显示为“www.example.com\projectName”的网址。我想删除该模块文件夹名称。
I have a user control in the modules folder of my project. and I have a link like
Test in this control. When ever I mouseover this "Test" on the page, I can see the whole url like this "www.example.com\projectName\Modules". But I want to make it such a way that it should display the url as "www.example.com\projectName". I want to get rid of that modules folder name.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我假设您想更改状态栏中显示的悬停文本?
为此,您可以使用以下内联脚本来执行此操作:
这将生成一个带有文本
Google
的链接,当您将鼠标悬停在其上时,状态栏文本将显示为http:// www.google.com
而不是实际的网址http://www.google.com/somegarbage
。您只需更改上面的代码即可通过替换
onmouseover
事件中分配的文本来注入您想要的任何内容。I am assuming here you want to change the hover text that appears in the status bar?
To do some you could use the following inline script to do so:
This would produce a link with the text
Google
and when you hover over it the status bar text would show ashttp://www.google.com
instead of the actual url which ishttp://www.google.com/somegarbage
.You can just change the code above to inject whatever you want by replacing the text being assigned in the
onmouseover
event.默认情况下,Href 属性只会附加当前 url。因此,如果您在这样的页面上
,并且在该页面的 html 中
,那么生成的 url 将是
但是,如果您在 href 前添加
/
字符,那么它将使链接相对到网站根目录,它会给你你正在寻找的东西。将转到
所以在你的情况下......
让你的链接像这样..
By default the Href attribute will just append the current url. So if you're on a page like
and in the html for this page you have
Then the resulting url will be
However, if you prefix the href with a
/
character, then it will make the link relative to the site root and it will give you what you're looking for.will go to
So in your case....
Make your link like this..
如果您可以设置您的要运行服务器,您可以执行以下操作:
If you can set your <a> to runat server, you can do: