单个链接取消链接并触发js事件
批量将网页中的链接取消或重新设置链接的代码: 如果想让指定id的链接字取消或恢复链接可以参考下面的代码
var e=document.getElementById( "link1 ")
//设置
e.setAttribute( "href ",e.rel)
//取消
e.setAttribute( "rel ",e.href)
e.removeAttribute( "href ")
代码说明:为什么取消需要加上e.setAttribute( "rel ",e.href) ,这段代码就是为a增加一个rel熟悉并设置好链接,方便后来的恢复链接。
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn