Javascript JQuery对话框在IE中不起作用
为什么这个代码在IE中不起作用?我应该怎么做才能使它正常工作? 以下代码在Firefox、Chrome和Opera中生成预期的jQueryUI模式弹出对话框。但是,它在Internet Explorer中失败Javascript JQuery对话框在IE中不起作用,javascript,jquery,Javascript,Jquery,为什么这个代码在IE中不起作用?我应该怎么做才能使它正常工作? 以下代码在Firefox、Chrome和Opera中生成预期的jQueryUI模式弹出对话框。但是,它在Internet Explorer中失败 <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jq
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
</head>
<body>
<script language="JavaScript">
$(document).ready(function() {
console.log( "ready!" );
$("#link1").on("click", function(e) {
var link = this;
e.preventDefault();
$("<div>Are you sure you want to continue?</div>").dialog({
buttons: {
"Ok": function() {
window.location = link.href;
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
});
});
</script>
<a id="link1" href=http://google.com>test link</a>
</body>
</html>
$(文档).ready(函数(){
console.log(“准备就绪!”);
$(#link1”)。在(“单击”上,函数(e){
var-link=这个;
e、 预防默认值();
$(“确实要继续吗?”)。对话框({
按钮:{
“Ok”:函数(){
window.location=link.href;
},
“取消”:函数(){
$(此).dialog(“关闭”);
}
}
});
});
});
试试看
window.location.assign(link.href)如果IE