我想換一次函數的變化。但是對於這種變化,不斷嘗試將檢測變化的交換功能與以前的事務聯繫起來。作爲一個例子,我把戒備。正如你在警報過程中看到的一樣,這個過程不斷增長。我只是點擊過程中重複這個過程,使我能做什麼?jquery重複問題
感謝您的關注。
版本的代碼運行:http://www.smyrnart.com/deeplinking/index.html
我的代碼;
的Index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://www.asual.com/jquery/address/samples/express/jquery.address-1.3.min.js"></script>
<script type="text/javascript">
$('a').address(function() {return $(this).attr('href').replace(/^#/, '');});
$.address.change(function(event) {
var url="";
if (event.value=='/index1') {url = "index1.html"}
else if (event.value=='/index2') {url = "index2.html"}
if (url!==""){
$.ajax({url : url,success : function(data){$("#content").html(data);}});
}
});
</script>
</head>
<body>
<a title="" href="#/index1/">index1</a> | <a title="" href="#/index2/">index2</a>
<div id="content" style="margin-top:50px;"></div>
</body>
</html>
Index1.html
<strong>in order;</strong><br/><br/>
index1<br/>
index2<br/>
index1<br/>
index2<br/><br/>
alert: problem repeat
Index2.html
<script type="text/javascript">
$.address.bind('change', function(e) {
//I used as examples only. anything else to do here, but should be resolved in this process of repetition.
alert('problem')
});
</script>
<div>
$.address.bind('change', function(e) {
alert('problem')
});
<strong>Go now #index1, at this #index2</strong>
</div>
感謝user909159。但沒有解決我的問題。 –