JS触发<a>,JS事件模拟

<pre name="code" class="html">JS触发<a>,JS事件模拟

 
 
<pre name="code" class="html">
</pre><pre name="code" class="html"><!DOCTYPE html>
<html>
<head>
<meta charset="GBK">
<title>Insert title here</title>
</head>
<body>
<input type="button" value="下载" onclick="ddd()"/>
<a id="12" href="dwo.jsp" style="display: none;">下载</a>
<script type="text/javascript">
	function ddd(){
		var a12=document.getElementById("12");
		var hr = a12.href;
		a12.href = hr+"?aa=abs";
		
		alert(a12.href);
		//禁用原来 a 默认 onclick 事件
		a12.setAttribute("onclick",'');  
		a12.click("return true"); 
		a12.href = hr;
       // window.open(a12.href);
	}
</script>
</body>
</html>


 

猜你喜欢

转载自blog.csdn.net/wbxx727124/article/details/50705332
今日推荐