[英]IE7, JQuery UI Dialog
I'm using JQuery UI Dialog. 我正在使用JQuery UI对话框。 In this form, I validate something.I call this function;
以这种形式,我验证了一些东西。
MessageBox('this is message', 'Error', OpenDialog());
In Chrome, Firefox,IE8,IE9; 在Chrome,Firefox,IE8,IE9中; It works correctly but in IE7, only dialog's header shows like this.
它可以正常工作,但在IE7中,仅对话框标题显示如下。 When I click 'Okey' button, It only shows header
当我单击“ Okey”按钮时,它仅显示标题
How to solve this?
如何解决呢?
MessageBox function MessageBox功能
function MessageBox(text, title,Func) {
var dv = document.createElement('div');
$(function () {
dv.id = 'Dialog';
dv.innerHTML = '<table style="font-family:Calibri;"><tr><td>' + text + '</td></tr></table>';
document.forms[0].appendChild(dv);
var dlg = $('#Dialog').dialog({
autoOpen: false,
width: 400,
title: title,
modal: true,
resizable: false,
buttons: [
{
text: "Okey",
width: 80,
click: function () {
DialogClose_('Dialog');
}
}],
open: function () {
$('.ui-dialog-buttonpane').find('button:contains("Okey")').addClass('ButtonDefault');
},
close: Func,
beforeClose: function () {
var dv2 = document.getElementById("Dialog");
dv2.parentNode.removeChild(dv2);
}
});
dlg.parent().appendTo(jQuery('form:first'));
$('#Dialog').dialog("option", "minWidth", 400);
$('#Dialog').dialog('option', 'position', 'center');
$('#Dialog').dialog('open');
});
return;
} }
OpenDialog function like this; 这样的OpenDialog函数;
function OpenDialog() {
$(document).ready(function () {
$("#dialog").dialog("open");
});
}
Having a look around there seems to be quite a few issues with the height on dialog boxes in IE7. 环顾四周,IE7中对话框的高度似乎有很多问题。
You could try specifying a height, but that would take away the nice auto-height feature you get. 您可以尝试指定一个高度,但是这样可以消除您获得的出色的自动高度功能。
Alternatively you could just set the height of the browser just after where you set the "dlg" variable is IE7: 另外,您也可以在设置“ dlg”变量为IE7之后设置浏览器的高度:
if ($.browser.msie && parseInt($.browser.version, 10) == 7) {
$('#Dialog').dialog("option", "height", 100);
}
You can replace the "100" with what you think. 您可以用自己的想法替换“ 100”。 If you have a container element in your dialog box you can always use that to set the height, eg:
如果对话框中有一个容器元素,则始终可以使用它来设置高度,例如:
$("#container").height();
There is also more suggestions on StackOverflow . 在StackOverflow上还有更多建议。
Hope that helps. 希望能有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.