href="javascript:void(0);"在IE6中将断异步请求
Html页
<a href="javascript:void(0);" ><img id="SubmitFeedback" src="/images/comment_btn.gif" /></a>
脚本
$(document).ready(function() {
alert("页面刷新");
$("#SubmitFeedback").bind("click", Test);
});
function Test() {
alert("调用Test");
$.getJSON("url", function() {
alert("调用callback");
});
return false; // 如果注释此行,IE6下将不能执行getJSON的callback
}
当a标签的href属性为"javascript:void(0);"时,IE6认为应该进行页面跳转,所以中断了异步请求的callback;
FireFox3.5在页面真正跳转时才中断异步请求,不存在callback不执行的问题。
相关文档:
源码:
function resize(img, width, height) {
(img.width > img.height)
? ((img.height = Math.min(height, width * img.height/img.width)) || (img.width = Math.min(width, img.width)))
: ((img.width = Math.min(width, height * img.width/img.height)) || (img.height = Math.min(hei ......
/*
-------------- 函数检索 --------------
trim函数: trim() lTrim() rTrim()
校验字符串是否为空: &n ......
<script type="text/javascript">
function fnOnPageChanged(page) {
var url = '<?=url('ShowFront','Search',$Request);?>' + '&page=' + page;
//alert(url);
document.location.href = url;
}
</script>
<select id="selectPage" onChange="fnOnPageC ......
function strToDate(){
var nowDate = new Date();
var oldDate = '2009-06-08';
var oldTime = '16:00';
var year = oldDate.substr(0,4);
var month = oldDate.substr(5,2);
var day = oldDate.substr(8,2);
var temDate = month+'/'+day+'/ ......