简体   繁体   中英

(Only in IE) SCRIPT65535: Unexpected call to method or property access. main.js, line 152 character 28

After going through several stackoverflow posts regarding this error and none of them actually apply to my case, I am getting this error on a line in my js file in developer tools while debugging:-

var el = $("#" + tagName);
 el.val(el.html(value).text()); //this is the one where debugger points to

This is the relevant code in js file:-

 $.ajax({
        type: "get",
        url: "cgi-bin/system_status.cgi?tokn="+sessnID+",active="+tickle_activity+",id="+page_id+",sub="+sub_id+",tab="+tab_id,
        dataType: "xml",
        success: function (xml) {
            errorCnt = 0;
            $(xml).find('response').children().each(function () {
                if (this.nodeName === "user_info") {
                    parseUserInfo(this);
                }
                else {
                    $(this).children().each(function () {
                        var tagName = this.tagName;
                        var value = $(this).text();
                        /* If this is a time block then do some translation */
                        if (tagName === "time") {
                            if (showTimeValues != undefined) { showTimeValues(this); }
                        }
                        else if (tagName === "satellite") {
                            if (parseSatDataXml != undefined) { parseSatDataXml(xml); }
                        }
                        else if (tagName === "ntpstatus") {
                            if (parseNtpDataXml != undefined) { parseNtpDataXml(xml); }
                        }
                        else if (tagName === "alarms") {
                            if (parseAlmDataXml != undefined) { parseAlmDataXml(xml); }
                        }
                        else if (tagName === "alarmSettings") {
                            if (parseAlmSettingDataXml != undefined) { parseAlmSettingDataXml(xml); }
                        }
                        else if (tagName === "status") {
                            setStatusTextColor(value);
                            setStatusButton(value);
                            $("#" + tagName).val(value);
                        }
                        else {
                           var el = $("#" + tagName);
                           el.val(el.html(value).text());//error thrown

                        }
                    });
                }
            });

Only in IE im having this issue, in all other browsers it works fine and i dont observe anything else other than that error in the debugging tools. I am using IE9 and latest jquery version 1.12.1

Actually, even though I was using IE9 in my developer tools there was an option which said Browser Mode: and it was set to IE7 standards. That is why I was getting this error. The moment i switched to IE9 standards (not the compatibility mdoe option). It all works as expected. If you are new to web development like me you might encounter this issue(not being aware that there are browser modes) as well. So in summary, In debugger tools (F12) -> Click on browser mode and choose IE9 .

Dont choose the compatibility option.

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