關於jQuery雙事件多重加載的問題。

<html>
<a href="1**.html">
	<button onclick="buttonEvent()">點擊事件</button>
</a>
</html>


function buttonEvent(){
		location.href = "2**.html";
	}


如代碼顯示那樣,當點擊button按鈕的時候想跳轉到2**.html頁面。可是,這個最終執行的結果是,先跳轉到2**.html頁面,而後再跳轉到1**.html頁面,最終顯示的結果是1**.html頁面中的內容。html


那麼,在function中加入下面的代碼才能夠達到上面的目的。code


function buttonEvent(e){
		e = e || window.event;
		e.stopPropagation();
		e.preventDefault();
		location.href = "2**.html";
	}
相關文章
相關標籤/搜索