window.location doesn't seem to work



Hey, guys!

I'm new to javascript, and i've got a problem with one of the simple
functions.

I am trying to redirect a user after he presses a button. Here is the
code:
<form method="post"
name="form2"
action="">
<center>
<label><input id="getRecomendation"
value="Get my recomendation"
type="submit"
name="getRecomendation"
onclick="giveRecomendation()">
<script type="text/javascript">
function giveRecomendation()
{
window.location = "foo.html";
//alert(window.location);
}

the page is run in Firefox from local hard drive.
if alert(window.location) is uncommented, everything works just fine.
but if i comment it, nothing happens.

what's wrong?
.



Relevant Pages

  • Re: Javascript error message using tags
    ... Don't redirect on JS Disabled, ... page;}else{redirect to you need to enable javascript page;} ... UA's that don't even support JS. ... browsers I have, but I wanted to know how the browsers out there react. ...
    (comp.lang.javascript)
  • Re: Problem with SSL
    ... When I use the fully qualified URL for the index.htm page, the redirect to ... http://www.mysite.com/secure/index.asp then the client side javascript works ... >> of the website root directory. ...
    (microsoft.public.inetserver.iis.security)
  • Re: Script is disabled. Please click Submit to continue.
    ... Javascript POST redirect which is supposed to run in the "on load" event. ... This script POSTs the SAML token to the destination URL. ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.windows.server.active_directory)
  • Re: Two Submit buttons on one form
    ... idea, IMO, to rely on javascript when you don't have to. ... I agree, PHP could handle it, just post the form to a single script which will redirect to your desired location. ... process it and then directly redirect the user or reload the page without the $_GET but I think you might be limited in the size of the form. ...
    (comp.lang.php)
  • Re: Page Has Expired
    ... > doing a redirect using META Refresh or Javascript. ... >> my work computer as well. ... and I do a lot of graphic arts work in my job there ...
    (microsoft.public.windows.inetexplorer.ie6.browser)