如何从URL隐藏锚标记

时间:2012-04-06 15:02:28

标签: php javascript html anchor

如何隐藏地址栏中以下链接href的哈希值?

<a href="index.php#dev_name">

所以它会将我重定向到index.php#dev_name,但我希望地址栏只显示index.php

1 个答案:

答案 0 :(得分:1)

您可以使用Javascript onclick事件。浏览器仍会显示index.php,但onclick事件将首先触发,并将浏览器重定向到右侧页面。

<a href="index.php" onclick="location.redirect('index.php#dev');">
相关问题