当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - I don't want to print # sign in url

问题描述:

<a href="#" onClick="load_page()">intro</a>

I don't want to print # sign on URL, I wanted it to look like below :

www.mydomain.com/

But it looked like this

www.mydomain.com/#

Anyway to do this?

网友答案:

Change the URL to:

<a href="/" onClick="load_page(); return false;">intro</a>

?

网友答案:

One popular way is to assign href="javascript:void(0)" Another one is to prevent anchor default action via return false in click handler as jacouh answered. I would prefer the second way as more clean.

分享给朋友:
您可能感兴趣的文章:
随机阅读: