I am new here.I have a textbox in my form where user is supposed to enter zip codes and as soon they enter that and press tab or click elsewhere on the form it is supposed to go to javascript function called UpdateCityState which takes that textbox as object and updates City and State Values.The code is
Expand|Select|Wrap|Line Numbers
- <asp:textbox id="txtZip" onkeydown="if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {txtName.focus();return false;}" runat="server" name="txtZip" width="75px" maxlength="9" enabled="False" autopostback="true" onchange="UpdateCityState(this);">
Expand|Select|Wrap|Line Numbers
- function UpdateCityState(objControl) {
- var strVars = "";
- var ZipValid = /^\d{5}(\d{4})?/;
- if (document.getElementById('ddCountry').value == 'E1')
- ZipValid = /\w\d\w(\s)?\d\w\d/;
- if (ZipValid.test(objControl.value))
- {
- strVars = "Zip=" + document.getElementById('txtZip').value + "&Country=" + document.getElementById('ddCountry').value + "&Ship=" + document.getElementById('ddShipTo').value;
- }
- else
- strVars = "Clear=All&Country=" + document.getElementById('ddCountry').value;
- parent.ifCityState.location.replace("ddCityState.aspx?" + strVars);
- }
Problem is that this piece of code fires perfeclty in internet explorer but in firefox sometimes it does sometimes it doesn't.It's very unpredictable.So my question is why is this happening in firefox and how can i stop this ?
Please help