这是我一直在使用的 jquery-ui 模态代码:
//jQuery form dialog modal popup and submit
$(function() {
$("#facilitiesForm").validate();
$("#facilityForm").dialog({
autoOpen: false,
height: 470,
width: 650,
modal: true,
buttons: {
"Send To The Facilities Manager": function() {
$("#facilitiesForm").submit();
},
"Cancel": function() {
$( this ).dialog( "close" );
},
},
close: function() {
allFields.val( "" ).removeClass( "ui-state-error" );
}
});
$("#helpForm").validate();
$("#helpdeskForm").dialog({
autoOpen: false,
height: 570,
width: 650,
modal: true,
buttons: {
"Send To The Helpdesk": function() {
$("#helpForm").submit();
},
"Cancel": function() {
$( this ).dialog( "close" );
},
},
close: function() {
allFields.val( "" ).removeClass( "ui-state-error" );
}
});
$("#adminForm").validate();
$("#adminTasksForm").dialog({
autoOpen: false,
height: 470,
width: 650,
modal: true,
buttons: {
"Send To The Admin": function() {
$("#adminForm").submit();
},
"Cancel": function() {
$( this ).dialog( "close" );
},
},
close: function() {
allFields.val( "" ).removeClass( "ui-state-error" );
}
});
$("#contactFacilityManager")
//.button()
.click(function() {
$( "#facilityForm" ).dialog( "open" );
});
$("#contactHelpdesk")
//.button()
.click(function() {
$( "#helpdeskForm" ).dialog( "open" );
});
$("#contactAdminTasks")
//.button()
.click(function() {
$( "#adminTasksForm" ).dialog( "open" );
});
});
我刚开始注意到一个错误,弹出框在 IE 中不起作用。我得到的错误是:
Webpage error details
Message: Expected identifier, string or number
Line: 16
Char: 6
Code: 0
URI: http://newintranet/js/script.js
任何想法为什么这在 IE 上不起作用(在 Chrome 和 FF 上运行良好)?