Q:

Using a 'if' redirect

I'm trying to create a page with a form and the answer depends on which page to redirect. The form and javascript works 100% correctly if I use alerts. I've tried to replace the alerts with window.location commands and other ideas but nothing happens. Can someone explain how to do this and more importantly your suggest works?
This works fine:
<script type = "text/javascript">
<!--
function checkAnswers()
{
    var myQuiz = document.getElementById( "myQuiz" );
    if ( myQuiz.elements[ 1 ] .checked)
       alert( "Correct");
    else
       alert( "Failed" );
};
</script>

This does not work!:
<script type = "text/javascript">
<!--
function checkAnswers()
{
    var myQuiz = document.getElementById( "myQuiz" );
    if ( myQuiz.elements[ 1 ] .checked)
        window.location = "www.bing.com";
    else
        window.location = "www.google.com";
};
</script>

A:

You don't say what's happening, but you're probably getting a 404 error, right?
If your URLs do not start with http://, they will be considered relative, and the browser will try to take you to a page that does not exist. Use this:
function checkAnswers()
{
    var myQuiz = document.getElementById( "myQuiz" );
    if ( myQuiz.elements[ 1 ] .checked)
        window.location = "http://www.bing.com";
    else
        window.location = "http://www.google.com";
};

