简体   繁体   中英

IE9 in Quirks Mode.. what could be causing issues with this code?

I'm using the following code:

(abridged JavaScript)

Input = {};
Input.URL = 'http://my.script.location/script.php';

Input.populateFaculties = function() {
    $('#courses').empty();
    $('#courses_reset').empty();

    $('#faculties').append('<select id="faculty_populated"></select>');

    for (var i = 0; i < Input.courses.length; i++) {
        $('#faculty_populated').append('<option value="' + Input.courses[i].Faculty_ID + '">' + Input.courses[i].Title + '</option>');
    }

    $('#faculty_populated').on("click", "option", function(event) {
        var id = $(this).val();
        UWA.Data.getJson(Input.URL + '?cmd=populateCourses&faculty=' + id, Input.populateCourses);
    });
}

Input.populateCourses = function(data) {
    $('#faculties').empty();
    $('#courses_reset').html('<img src="/user/74/138869.png" style="width:24px;" alt="Reset options" />');

    $('#courses_reset').on("click", "img", function(event) {
        Input.populateFaculties();
    });

    $('#courses').append('<select id="courses_populated"></select>');

    for (var i = 0; i < data.length; i++) {
        $('#courses_populated').append('<option value="' + data[i].Course_ID + '">' + data[i].Course + '</option>');
    }
}

(abridged HTML)

<tr>
    <td class="left">Course</td>
    <td>
        <span id="faculties">

        </span>

        <span id="courses">

        </span>

        <span id="courses_reset">

        </span>
    </td>
</tr>

Which works perfectly in FireFox, but doesn't work in Internet Explorer 9.

It's worth noting that IE is in "Quirks" mode because of the Netvibes UWA widget framework that I'm using, so I have no control over forcing it in to standards mode.

I don't see any errors, but upon clicking the faculty drop-down, nothing happens . In FireFox, clicking the #faculty drop-down empties #faculty and populates #courses .

Is there anything in this code which appears obvious as to why Internet Explorer might not process the code?

It's likely an issue in or before your doctype that's causing the issue. Netvibes UWA will not put IE in quirks mode (if it does it's a bug).

Providing a link/paste to your code may help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM