2

I will preface my post with the caveat that I am a brand-new jQuery user. I am an experienced programmer -- started programming on the IBM System/34 in 1985. I have only been doing web-development for the past 5 years -- using the IBM System i as the http server; writing applications for K-12 schools (attendance, grading, etc.).

I have fallen in love with jQuery -- it's the closest thing to poetry I have ever come across in the programming world. However, I still have A LOT to learn about it.

Anyway ... to my problem. (BTW: I have searched extensively, both on the StackOverflow site and this site, but cannot find a reference to the issue I am having.)

First of all ... for reasons I will not endeavor to explain at present, the applications I am writing must run in Internet Explorer (and IE only).

I have just implemented a jQuery UI modal dialog with a form containing four check boxes. The dialog works just fine in IE10 (and in Chrome). But, in IE10 Compatibility View, or in IE9, the dialog title bar and the dialog positioning is not working correctly. Here is a screenshot of what is happening:

http://i278.photobucket.com/albums/kk110/schryver1960/IE9-jquery-problem.jpg

As you can see, the dialog title is not appearing correctly inside the "title bar" of the dialog, nor is the "X" of the title bar appearing. Also, the dialog should be centered in the window, but instead it appears to be positioned at "left", "top". I have tried defining the position property, but it doesn't make any difference to the placement of the dialog -- it always positions itself at the upper left-hand corner of the window.

What you are seeing in the image is as follows: the "top" window is the "header" portion down to the menu bar (Home, Menus, Active, etc.). The top window defines an iframe inside of which is the application window. The application window consists of the "header" (everything down to and including the column headings) and a "footer" (the bar with the "Start Over" and "Submit Changes" buttons). The "subfile" rows and columns are inside an iframe defined within the application window. So, to review: Top Window with an iframe; Application Window inside that iframe, with an iframe of its own; student course requests lines inside that iframe. (I hope that makes sense.)

The div for the dialog is coded on the page that outputs the application window (entitled "Maintain Student Course Requests") as follows:

<div id="schOptions" class="ui-widget">
  <table width="270" border="0" cellpadding="2" cellspacing="0">
        <tr valign="middle">
              <td height="22" width="10">&nbsp;</td>
              <td width="220" class="stdLabel"</td>
              <td width="20" align="center"><input name="PFILL" type="checkbox" id="PFILL" value="Y"></td>
              <td width="10">&nbsp;</td>
        </tr>
        <tr valign="middle">
              <td height="22">&nbsp;</td>
              <td class="stdLabel">Use Alternate Match Groups?</td>
              <td align="center"><input type="checkbox" name="PMGN" id="PMGN" value="Y"></td>
              <td>&nbsp;</td>
        </tr>
        <tr valign="middle">
              <td height="22">&nbsp;</td>
              <td class="stdLabel">Schedule Study Hall?</td>
              <td align="center"><input type="checkbox" name="PSTUDY" id="PSTUDY" value="Y"></td>
              <td>&nbsp;</td>
        </tr>
        <tr valign="middle">
              <td height="22">&nbsp;</td>
              <td class="stdLabel">Reset Previous Requests?</td>
              <td align="center"><input type="checkbox" name="PRESET" id="PRESET" value="Y"></td>
              <td>&nbsp;</td>
        </tr>
  </table>

Here is the code that initializes the dialog:

    <script type="text/javascript" language="javascript">
/*====================
 * jQuery Ready Shell
 *====================*/
$(document).ready(function() {



/*=====================================
 * Initialize Scheduler Options Dialog
 *=====================================*/
$('#schOptions').dialog({
       autoOpen: false,
       title: "Scheduler Options",
       modal: true, 
       buttons: [{
         text: "Cancel",
         click: function() { 
      // Close dialog
         $(this).dialog("close");
        } // End "click" event function
       }, // End "Cancel" button definition
       {
         text: "Process",
         click: function() {
      // Process scheduler
         processScheduler();
      // Close dialog
         $(this).dialog("close"); 
        } // End "click" event function
       }] // End "Process" button definition
  }); // End #schOptions dialog definition



}); // End Ready Shell

</script>

Pretty simple and straightforward, it would seem. And, as I have already mentioned, everything works just fine in Chrome, and also in IE10, but not in IE10 compatibility view, nor in IE9. Unfortunately, I can't just tell users to update to IE10. In fact, we can't even use IE10 at present, because of other problems IE10 presents with our applications. So, most of our users (there are several thousand at any given moment during the day) are actually using IE10 in compatibility view.

Any ideas?

Thanks.

edited to add:

This may be important, and I neglected to mention it above: I am retrieving the .css and .js libraries via the Google CDN; using the "Smoothness" theme for the time being (although I will definitely move to a custom theme before too long). Here is that code:

    <!-- jQuery Style Sheet (Theme: Smoothness) -->
<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css">

<!-- jQuery and jQuery-ui -->
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>

Incidentally, the dialog is opened by a button that it covers up by appearing in the top left corner of the window.

Here is the relevant code:

    <a name="RunScheduler" href="javascript: promptScheduler();" 
      class="buttonLink">Run Scheduler</a>

/*=================================================
 * promptScheduler -- Prompt for Scheduler Options
 *=================================================*/
function promptScheduler() {
      $("#schOptions").dialog("open");
} 

Also, the modal dialog "shading" effect on the background window area, as well as other style properties of the dialog window, are not working. It would seem that an entire set of style classes is not being correctly applied, including the dialog window positioning properties. The question is why? It appears that some of the .css properties are taking effect.

4

2 回答 2

1
<!doctype html>

在页面开头添加以上行对我有用。

于 2015-08-25T09:12:23.783 回答
0

我知道这是一个老问题,但由于它没有答案而且我也遇到了同样的问题,所以我想我会添加我的解决方案。我确定 jqueryui 对话框在 IE 兼容模式下显示不正确,除非指定以下文档类型:

<!doctype html>

添加它,看看它是否有效。

于 2014-09-09T15:49:13.650 回答