Solved

Browser Issue

Posted on 2011-03-10
19
365 Views
Last Modified: 2012-05-11
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
Comment
Question by:KavyaVS
  • 10
  • 9
19 Comments
 
LVL 13

Accepted Solution

by:
gamarrojgq earned 500 total points
ID: 35095491
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
 

Author Comment

by:KavyaVS
ID: 35095684
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
 

Author Comment

by:KavyaVS
ID: 35095949
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
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35095972
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
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35096050
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
 

Author Comment

by:KavyaVS
ID: 35096621
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
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35096761
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
 

Author Comment

by:KavyaVS
ID: 35096803
   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
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35096955
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:KavyaVS
ID: 35097648
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
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35097752
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
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35097906
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
 

Author Comment

by:KavyaVS
ID: 35098584
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
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35099167
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
 

Author Comment

by:KavyaVS
ID: 35108576
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
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35108623
Ok, use onblur instead of onfocusout, since onblur will fire in both browsers (IE and Firefox)
0
 

Author Comment

by:KavyaVS
ID: 35108896
Thank You So much. onblur is working in Firefox.
Your prompt responses are really appreciated.
0
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35108928
Great! glad to help, don't forget to accep the solution :)
0
 

Author Closing Comment

by:KavyaVS
ID: 35108930
All the answers really helped me to fix the problem.
Thanks.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now