开发者

Working in FireFox but not IE... sort of

开发者 https://www.devze.com 2023-04-05 10:16 出处:网络
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 Fir

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(targetDateVa开发者_运维技巧lue);
        },
        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')"

0

精彩评论

暂无评论...
验证码 换一张
取 消