我的网址是
http://xizi.tk/bbs/hack.php?H_name=bet2而页面锚点是
<a name="haodifang"></a><a target="_self" href="#haodifang" onClick="javascipt:fanhui()" style="cursor:hand"><font color="red">我说:</font> 再来一次,不赌不知时运高。[返回]</a><br>而鼠标放到链接上时显示的链接地址是
http://xizi.tk/bbs/#haodifang点击之后也确实跳转到
http://xizi.tk/bbs/去了奇怪了
之前我在一个htm页面测试的时候一切正常,改成php了就不行了,有这种事吗?

解决方案 »

  1.   

    <a name="haodifang"></a>中间加个空格
      

  2.   

    onClick="javascipt:fanhui()"
    去掉
    这里面你写的是什么?
      

  3.   

    function fanhui()
    {
    document.getElementById('d1').style.display='';
    document.getElementById('d2').style.display='none';
    document.getElementById('d3').style.display='none';
    return false;
    }
      

  4.   

    是否加空格无效,是否去掉onclick="javascript:fanhui()"也无效
      

  5.   

    为了方便让大家看到源码,我已经处理了一下
    http://xizi.tk/bbs/hack.php?H_name=bet2大家一眼就可以看到不对劲了
      

  6.   


    http://xizi.tk/bbs/hack.php?H_name=bet2
    上的锚点链接#haodifang,居然会链到
    http://xizi.tk/bbs/#haodifang
      

  7.   

    为啥
    http://xizi.tk/bbs/
    我在这个界面,没有发现#haodifang这个锚点
      

  8.   

    找到问题所在了
    <base id="headbase" href="http://xizi.tk/bbs/" />
    但是这句是在页头的head.php中,不好改动这句,有没有什么变通的办法实在不想写绝对地址到链接里面
      

  9.   

    不想写成
    <a href="http://xizi.tk/bbs/hack.php?H_name=bet2#haodifang">
    有别的写法吗,尽量直接而简洁。不要写函数能实现吧。为这个写函数就没意思了,感觉
      

  10.   

    锚点上加个ID试试我记得有一次就是锚点没加id所以无法跳转
      

  11.   

    应该是你的代码的问题吧。下面的测试是没有任何问题的
    <p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p>
    <p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p>
    锚点位置<a name="haodifang"></a>
    <p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p>
    <p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><script>
    function fanhui()
    {
    alert("ok")
    }
    </script>
    <a target="_self" href="#haodifang" onclick="fanhui()" style="cursor:hand"><font color="red">我说:</font> 再来一次,不赌不知时运高。[返回]</a><br>
      

  12.   

    是base的问题。
    怎么能简洁的解决呢
      

  13.   

    fanhui()函数里自己得到全部的路径处理吧