简体   繁体   中英

Working in FireFox but not IE… sort of

I know this is going to be sort of vague but I am not really able to link to my code for examples.

I have an application that is being written in html/jquery. When I run it on my local machine in FireFox and IE it works fine. The problem is when i put it on our server i am losing functionality in one part of the application within IE. It works fine in FF.

It is losing functionality on a select box that does something on change.

I am convinced it has to be some sort of referencing issue but other calls to the file with that function in it work fine. Also i have moved the function to the same file to see if it was somehow missing the function in the referenced file, but that also did not work.

Does anybody by chance have somethings that i could try to get this to work?

Here is the code for the select box and the function:

<select id="POCreateDateRange" class="valid" name="dynamicStartRange" onchange="onDateRangeChange("POCreateDate", 'Range')">
<option value=""></option>
<option value="lastMonth">Last Month</option>
<option value="lastTwoWeeks">Last Two Weeks</option>
<option value="lastWeek">Last Week</option>
<option value="yesterday">Yesterday</option>
<option value="today">Today</option>
</select>

code for the function:

function onDateRangeChange(id, type)
{
    var targetId = "#";

    if(type == "Range")
    {
        targetId += id;
    } else {
        targetId += (id+"toDate");
    }

    var currentDropDown = "#" + id + type;
    var selectedOption = $(currentDropDown).val();

    // to ajax call here..
    $.ajax({
        url: "PATH_REMOVED",
        type: "GET",
        dataType: "xml",
        data: "RandomNumber=" + Math.round() + "&dateParam=" + selectedOption, 
        success: function (xml) {
            var date = $(xml).find("dateString").text();

            var targetDateValue = (date==null||date=="")?$(targetId).val():date; 
            $(targetId).val(targetDateValue);
        },
        error: function (text) {
            alert("Something blew up.");
        }
    });
}

I will try and get you any more details that I can.

Thanks in advance!

EDIT So i changed to single quotes in IE dev tools and it worked. SO i made the changes to the code then deployed it. But it still doesnt work. I opened IE dev tools and changd it back to double quotes and it does work. Any ideas?

You have double quotes inside of double quotes.

Change the onchange to this:

onchange="onDateRangeChange('POCreateDate', 'Range')"

Or you can do:

onchange="onDateRangeChange(\"POCreateDate\", 'Range')"

Shouldn't those double quotes be single quotes?

onchange="onDateRangeChange("POCreateDate", 'Range')"

must be

onchange="onDateRangeChange('POCreateDate', 'Range')"

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