使用jQuery UI 1.7.2 dialog插件,遇到這樣的錯誤:
[img]http://dl.iteye.com/upload/attachment/308166/97c428e4-2ce2-367e-b4df-4c4da7686b95.bmp" alt="" width="210" height="44[/img]
$("#dialog").dialog({
width: 480,
height:"auto",
resizable: false,
draggable: true,
modal: true,
position: "center",
autoOpen: false,
dialogClass: "dialog",
buttons: {"關閉": function(){
$( this).dialog("close");
}}
});
$("#chglogpwd").bind("click", function(){
$("#dialog").dialog("option","height","400");
showModalDialog("#dialog","/accoun/acc/change_logpwd_fm.html?"+ new Date().getTime(),"修改登錄密碼");
});
function showModalDialog(dialogEl,url,title,callback){
var $ this = $(dialogEl);
$ this.html("");
$ this.dialog("option","title",title);
$ this.dialog("open");
$ this.load(url).removeClass("hideh");
}
width: 480,
height:"auto",
resizable: false,
draggable: true,
modal: true,
position: "center",
autoOpen: false,
dialogClass: "dialog",
buttons: {"關閉": function(){
$( this).dialog("close");
}}
});
$("#chglogpwd").bind("click", function(){
$("#dialog").dialog("option","height","400");
showModalDialog("#dialog","/accoun/acc/change_logpwd_fm.html?"+ new Date().getTime(),"修改登錄密碼");
});
function showModalDialog(dialogEl,url,title,callback){
var $ this = $(dialogEl);
$ this.html("");
$ this.dialog("option","title",title);
$ this.dialog("open");
$ this.load(url).removeClass("hideh");
}
調試了很久,發現在當前頁面上加載了jquery的js資源,在被load的那個頁面中也加載了jquery的資源。
<script type="text/javascript" src="/common/js/jquery-1.4.2.min.js"></script>
嘗試將被load的頁面中的jquery資源去除,錯誤便消除。
<script type="text/javascript" src="/common/js/jquery-1.4.2.min.js"></script>
嘗試將被load的頁面中的jquery資源去除,錯誤便消除。
經測試:asp.net mvc 1.0/2.0不會出現此錯誤,但是mvc 3.0中就會出現此錯誤