Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

Browser Issue

I am getting the BranchMap by ZIpCode.It is working in IE8. But is not working in FireFox 3.6.14 Basically I have a TextBox for entering Zip code and Find Button to get the BranchMap.
Button OnClick event has Javascript function

.aspx page
<input id="fnd_box" name="zipcode" maxlength="7" type="text" value="Find by Zipcode"
                              <a class="fnd_button" href="javascript:openMap();">Find</a>
                        

Javascript function:
  function openMap(){
      var ezip=document.branchmap.zipcode.value;
       if(!ezip || isNVa(ezip)) {
          alert('Please enter a valid zipcode.');
          return false;
      }
            var bmurl='http://www.branchmap.com/mapserver.php?client=xyz&mw=100&zpl=1&spl=2&zip='+ezip;
            window.open(bmurl,'branchmap','width=640,height=585,top=0,toolbar=no,personalbar=no,location=no,directories=no,statusbar=no,menubar=no,status=no,resizable=yes,left=100,screenX=100,top=100,screenY=100');
            }

How to make it work in FireFox 3.6.14 version.It's working fine in IE8.

Thanks
0
KavyaVS
Asked:
KavyaVS
  • 10
  • 9
1 Solution
 
gamarrojgqCommented:
Hi,

Did gives you an error message?

Try to change this line

var ezip=document.branchmap.zipcode.value

For this one

var ezip=document.GetElementById("fnd_box").value;

Also what is isNVa? a custom function? or perhaps you are trying to use isNAN  function?
0
 
KavyaVSAuthor Commented:
I tried this in javascrit function.var ezip=document.GetElementById("fnd_box").value;

But it is still working only in IE8 and not working in FireFox 3.6.14
I am using  isNaN(ezip) function.

Please let me know how to make it work in FireFox.

Thanks
0
 
KavyaVSAuthor Commented:
Again I am giving you the full code
.aspx page
<form onsubmit="javascript:openMap();" id="branchmap" name="branchmap" style="no_padding">
<input id="fnd_box" name="zipcode" maxlength="7" type="text" value="Find by Zipcode"
                              <a class="fnd_button" href="javascript:openMap();">Find</a>
                       
<img id="fnd" src="../assets/header.nav.search.gif" onclick="javascript:openMap();" />
</form>

Javascript function:
  function openMap(){
      var ezip=document.branchmap.zipcode.value;
       if(!ezip || isNaN(ezip)) {
          alert('Please enter a valid zipcode.');
          return false;
      }
            var bmurl='http://www.branchmap.com/mapserver.php?client=xyz&mw=100&zpl=1&spl=2&zip='+ezip;
            window.open(bmurl,'branchmap','width=640,height=585,top=0,toolbar=no,personalbar=no,location=no,directories=no,statusbar=no,menubar=no,status=no,resizable=yes,left=100,screenX=100,top=100,screenY=100');
            }

Please let me know how to make it work.

Thank You
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
gamarrojgqCommented:
ok, cause in your code example you have

   if(!ezip || isNVa(ezip)) {

so please check that in your page code you have it right

0
 
gamarrojgqCommented:
Ok, lets try it step by step, comment the if validation and try it, just to see if in Firefox can open the URL normally
0
 
KavyaVSAuthor Commented:
Thanks for your reply and suggestions.
I commented the validation and tried it in FireFox but it is not working. It is working in IE.
What to do next.

Thanks.
0
 
gamarrojgqCommented:
Ok, I've try your code in FireFox and works well, so, lets think in other posibilities, maybe is something more simple, have you checked that BLOCK POPUP WINDOWS is not ON in the browser options?

Go to TOOLS\OPTIONS\CONTENT
0
 
KavyaVSAuthor Commented:
   if(!ezip || isNaN(ezip)) {
          alert('Please enter a valid zipcode.');
          return false;
      }
The isNaN function is working in IE and showing alert message when I enetered non-number.
The  isNaN function is not working in FireFox and not showing alert message when I enetered non-number.

Please let me know your suggestions.
Thanks.
0
 
gamarrojgqCommented:
Ok, lets try something, comment ALL the code in openMap function, and just leave a simple

alert('Inside the Function');

And try it,  if the alert message did NOT shows up, perhaps you Firefox browser is not javascript enabled

And if you did see the alert message, uncomment the window.open call and try it like this

var ObjtReference;
ObjtReference = window.open( bmurl,'branchmap', 'width=640,height=585,top=0,toolbar=no,personalbar=no,location=no,directories=no, statusbar=no,menubar=no,status=no,resizable=yes,left=100,screenX=100,top=100,screenY=100');

0
 
KavyaVSAuthor Commented:
function openMap(){
       alert("Inside the function");
      var ObjtReference;
      var ezip=document.branchmap.zipcode.value;
      alert(ezip);
       if(!ezip || isNaN(ezip)) {
          alert('Please enter a valid zipcode.');
          return false;
      }
            var bmurl='http://www.branchmap.com/mapserver.php?client=xyz&mw=100&zpl=1&spl=2&zip='+ezip;
       ObjtReference= window.open(bmurl,'branchmap','width=640,height=585,top=0,toolbar=no,personalbar=no,location=no,directories=no,statusbar=no,menubar=no,status=no,resizable=yes,left=100,screenX=100,top=100,screenY=100');
            }

I tried the above code in FireFox. It is showing the inside function alert message. It is not showing the
next alert message alert(ezip).

I did TOOLS\OPTIONS\CONTENT  and BLOCK POPUP WINDOWS is not ON in.
So now the FireFox is javascript enabled as it is entering into the function. After that it is not working.

Any suggestions please.
Thanks.
0
 
gamarrojgqCommented:
ok lets do some debug, add alert message after all lines to see where stop working, copy the function attached, repalce yours with this


function openMap(){
        alert("Inside the function");
        var ObjtReference;
        var ezip=document.getElementById("fnd_box").value;
        alert("get the ezip" + ezip);
        if(!ezip || isNaN(ezip)) {
            alert('Please enter a valid zipcode.');
            return false;
        }
        alert("before assign the url");
        var bmurl='http://www.branchmap.com/mapserver.php?client=xyz&mw=100&zpl=1&spl=2&zip='+ezip;
        alert("before window.open ");
        ObjtReference= window.open(bmurl,'branchmap','width=640,height=585,top=0,toolbar=no,personalbar=no,location=no,directories=no,statusbar=no,menubar=no,status=no,resizable=yes,left=100,screenX=100,top=100,screenY=100');
    }

Open in new window

0
 
gamarrojgqCommented:
Another thing I just saw,  maybe the Firefox is not finding the zipcode textbox because it does not have a closing tag, so change this

<input id="fnd_box" name="zipcode" maxlength="7" type="text" value="Find by Zipcode"

for this one

<input id="fnd_box" name="zipcode" maxlength="7" type="text" value="Find by Zipcode" />
0
 
KavyaVSAuthor Commented:
The contents on .aspx page
<form onsubmit="javascript:openMap();" id="branchmap" name="branchmap" style="no_padding">
<input id="fnd_box" name="zipcode" maxlength="7" type="text" class="text_input" value="Find by Zipcode" onfocus="javascript:if (fnd_box.value == 'Find by Zipcode') fnd_box.value = ' ';" onfocusout="javascript:if (fnd_box.value == ' ') fnd_box.value = 'Find by Zipcode';" />
<a class="find_button" href="javascript:openMap();">Find</a>
<img id="find" src="../assets/header.nav.search.gif" onclick="javascript:openMap();" />
                        </form>

function openMap(){
        alert("Inside the function");
I tried your function. And it showed only Inside the function message.After that it is not showing anything.
Is there any mistake with onfocus and onfocusout? or any other suggestions please.

Thanks.

0
 
gamarrojgqCommented:
Ok,

there is anything else on your aspx page?

any other controls?

can you post all the content of the page?

did you have some codebehind that injects javascript on runtime to the page?

Also please, load your page and right click on it, and select VIEW PAGE SOURCE, and post that too so we can figure it out what is happaning.
0
 
KavyaVSAuthor Commented:
Now it is working in FireFox 3.6.14. The problem is there is one more javascript file and the .aspx page is using OpenMap() function from that other js file and that function missed document to retrieve zip.
It has var ezip = branchmap.zipcode.value;I added var ezip = document.branchmap.zipcode.value;
Then It is working..
The onfocus event working both in IE and FireFox.
The onfocusout() is not working in FireFox but it working in IE.It is showing Attribute 'onfocusout' is not a valid attribute of Element'input'
The contents on .aspx page
<form onsubmit="javascript:openMap();" id="branchmap" name="branchmap" style="no_padding">
<input id="fnd_box" name="zipcode" maxlength="7" type="text" class="text_input" value="Find by Zipcode" onfocus="javascript:if (fnd_box.value == 'Find by Zipcode') fnd_box.value = ' ';" onfocusout="javascript:if (fnd_box.value == ' ') fnd_box.value = 'Find by Zipcode';" />
<a class="find_button" href="javascript:openMap();">Find</a>
<img id="find" src="../assets/header.nav.search.gif" onclick="javascript:openMap();" />
                        </form>


Please give me an idea how to make ithe onfocuout to work on FireFox.

Thanks for all your suggestions and will assign you the points  as best solution.

Thanks.
0
 
gamarrojgqCommented:
Ok, use onblur instead of onfocusout, since onblur will fire in both browsers (IE and Firefox)
0
 
KavyaVSAuthor Commented:
Thank You So much. onblur is working in Firefox.
Your prompt responses are really appreciated.
0
 
gamarrojgqCommented:
Great! glad to help, don't forget to accep the solution :)
0
 
KavyaVSAuthor Commented:
All the answers really helped me to fix the problem.
Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 10
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now