首页 技术 正文
技术 2022年11月9日
0 收藏 401 点赞 4,192 浏览 935 个字

点击链接不做任何事情:

<a href="#" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  onclick="return false">test</a>
<a href="javascript:void(0);" rel="external nofollow" >test</a>
<a href="javascript:void(null)" rel="external nofollow" >test</a>
<a href="javascript:;" rel="external nofollow" >test</a>
<!-- 使用2个到4个#,见的大多是"####",也有使用"#all"等其他的 -->
<a href="####" rel="external nofollow" >test</a>
<!-- 好像在FF中不能显示 -->
<span style="cursor:hand">test</span>

点击链接后,响应用户自定义的点击事件:

<!-- 这里表示这个链接不做跳转动作,执行onClick事件 -->
<a href="javascript:void(0);" rel="external nofollow" onclick="alert('ok');"></a>
<!-- 这里表示这个链接不做跳转动作,执行doTest()函数 -->
<a href="javascript:doTest();void(0);" rel="external nofollow" >here</a>
<!-- 或者直接使用href="" rel="external nofollow" rel="external nofollow" -->
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" onclick="doSomething();return false;">什么问题都解决了,包括浏览器不兼容问题</a>
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" onclick="alert();event.returnValue=false;">test</a>

点击链接后,提交表单:

<a href="javascript:void(document.form.submit())" rel="external nofollow" >单此处提交表单</a>

链接的几种办法:

  1. window.open(''url'')
  2. window.location.href="" rel="external nofollow"  rel="external nofollow" 
  3. <script>
    function openWin(tag,obj)
    {
    obj.target="_blank";
    obj.href = "Web/Substation/Substation.aspx?stationno="+tag;
    obj.click();
    }
    </script>
    <a href="javascript:void(0)" rel="external nofollow" onclick="openWin(3,this)">株洲</a>

本文参考:opper

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,491
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,493
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,132
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,294