zoukankan      html  css  js  c++  java
  • href=#与href=javascript:void(0)的区别

    #"包含了一个位置信息,默认的锚点是#top 也就是网页的上端

    而javascript:void(0)  仅仅表示一个死链接

    这就是为什么有的时候页面很长浏览链接明明是#可是跳动到了页首,而javascript:void(0) 则不是如此

    打开新窗口链接的几种办法

      1.window.open('url')

      2.用自定义函数

            <script>
            function openWin(tag,obj)
            {
                obj.target="_blank";
                obj.href = "Web/Substation/Substation.aspx?stationno="+tag;
                obj.click();
            }
            </script>

         <a  href="javascript:void(0)" onclick="openWin(3,this)">LINK_TEST</a>

      3.window.location.href=""

    如果是个# ,就会出现跳到顶部的情况,个人收藏的几种解决方法:
    1:<a href="####"></a>
    2:<a href="javascript:void(0)"></a>
    3:<a href="javascript:void(null)"></a>
    4:<a href="#" onclick="return false"></a>
    5:<span style="cursor:hand"></span>(好像在FF中不能显示)

  • 相关阅读:
    时间模块(二)datetime
    xmltodict模块
    C和指针
    C和指针指针
    笔试2
    istream_iterator,ostream_iterator与vector的转换
    C++工厂方法与反射的简单实现
    rpcndr.h和wtypes.h冲突Bug的解决方案
    ubuntu 9.04 安装mysql
    QT in Ubuntu cannot find lfreetype
  • 原文地址:https://www.cnblogs.com/WebApp-DotNet/p/6432493.html
Copyright © 2011-2022 走看看