Ada County
asked on
OnChange Event not fireing in FireFox but works in IE
I'm trying to change an image on the form whenever a value is selected from the dropdownlist box. It works fine in Internet Explorer but the event doesn't seem to fire at all in FireFox. I put the Alert message in the script to see and it never pops up in FireFox but does with IE.
function ChangeEdgeImage(this) {
var strColor = source.options.value;
var strColorx = strColor.replace(/ /g, "_");
document.getElementById('color_EdgePreview').src = "images/colors/" + strColorx + ".jpg";
document.getElementById('color_EdgeZoom').href = "images/colors/zoom/" + strColorx + ".jpg";
document.getElementById('color_EdgeZoom').title = "Edge Color : " + strColorx;
alert("Edge change");
}
<asp:DropDownList class="product-attr-inside-color" ID="DropDownList1"
runat="server" DataSourceID="dsColors"
DataTextField="Color" DataValueField="Color" onchange="ChangeInsideImage(this);">
</asp:DropDownList
ASKER
I have two functions ChangeInsideImage and ChangeEdgeImage they are exact duplicates but change different images on the screen. I just copied the wrong field in my first post my bad. This is the field
<asp:DropDownList class="product-attr-edge-color"
ID="DropDownList2" runat="server" DataSourceID="dsColors"
DataTextField="Color" DataValueField="Color" onchange="ChangeEdgeImage(this);">
</asp:DropDownList>
Make sure if JavaScript is enabled in Firefox or not. This could be the reason for odd behavior of your application.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Found Solution internally
function ChangeEdgeImage(this) // Line 1
onchange="ChangeInsideImag