473,414 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Code works in IE, but only works sometimes in FireFox

Hi All,

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
  1. <asp:textbox id="txtZip" onkeydown="if ((event.which &amp;&amp; event.which == 13) || (event.keyCode &amp;&amp; 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
  1. function UpdateCityState(objControl) {
  2. var strVars = "";
  3. var ZipValid = /^\d{5}(\d{4})?/;
  4.  
  5. if (document.getElementById('ddCountry').value == 'E1')
  6.     ZipValid = /\w\d\w(\s)?\d\w\d/;
  7. if (ZipValid.test(objControl.value))
  8. {
  9.     strVars = "Zip=" + document.getElementById('txtZip').value + "&Country=" + document.getElementById('ddCountry').value + "&Ship=" + document.getElementById('ddShipTo').value;
  10.                  }
  11.  else
  12. strVars = "Clear=All&Country=" + document.getElementById('ddCountry').value;
  13.                 parent.ifCityState.location.replace("ddCityState.aspx?" + strVars);
  14.             }


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
Aug 14 '07 #1
6 2005
pbmods
5,821 Expert 4TB
Heya, smoitra. Welcome to TSDN!

Please do not type in ALL CAPS. Not only does it violate the Posting Guidelines, it also makes people less likely to want to read your problem and post solutions!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

Changed thread title to better describe the problem (did you know that thread titles that do not follow the Posting Guidelines actually get FEWER responses?).
Aug 14 '07 #2
acoder
16,027 Expert Mod 8TB
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 ?
So when it doesn't work in Firefox, what does it do?

Post the HTML code that the asp code turns into (view source on the client).
Aug 15 '07 #3
So when it doesn't work in Firefox, what does it do?

Post the HTML code that the asp code turns into (view source on the client).

The screen blinks as if it is trying to do something but then nothing gets populated in the City/State box
Aug 15 '07 #4
acoder
16,027 Expert Mod 8TB
The screen blinks as if it is trying to do something but then nothing gets populated in the City/State box
Does this happen for only some input or does the same input sometimes works and sometimes doesn't work?

Post the relevant HTML, e.g. txtZip, txtName, ddCountry, ddShipTo, the City/State box, etc.
Aug 15 '07 #5
The same input sometime works and sometime doesn't
Aug 15 '07 #6
acoder
16,027 Expert Mod 8TB
Post the rest of the relevant HTML code or a link to a test page.
Aug 15 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: dejausenet | last post by:
I have firefox 1.0, running on winxp Firefox blocks popups fine, but sometimes, for selected occassions only, i would like to be able to have window popup; without enabling whole domains, as...
14
by: David Blickstein | last post by:
I have some XML documents that I want to open in a web browser and be automatically translated to HTML via XSLT. I'm using an xml-stylesheet processing command in a file called "girml.xml". ...
192
by: Vortex Soft | last post by:
http://www.junglecreatures.com/ Try it and tell me what's happenning in the Microsoft Corporation. Notes: VB, C# are CLS compliant
8
by: titogarcia | last post by:
I want to execute server code invoked from inside Javascript code. I will have my server code in a servlet, callable with a URL, but how do I invoke the servlet from Javascript without reloading...
7
by: Andrea | last post by:
Hi there - I'm hoping someone can help me; I've been struggling with this for a few days! :-) I have a webpage that is comprised of many forms containing questions. As the user answers one...
14
by: Schraalhans Keukenmeester | last post by:
I am building a default sheet for my linux-related pages. Since many linux users still rely on/prefer viewing textmode and unstyled content I try to stick to the correct html tags to pertain good...
4
by: hiazle | last post by:
I have a Page that has one left div with id "sidebar", floats left and has a fixed width of 140px, then another div with id "content", a left margin of 160px, and a fixed width of 570px. Here is...
4
by: Kenny | last post by:
I have this Ajax app and sometimes I need to communicate with the server only for the side-effect, not expecting any HTML or JSOn data back, but I should wait on the ACK before proceeding to kick...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.