[Javascript] Help please

Sherwithme1 at cs.com Sherwithme1 at cs.com
Thu Jan 24 12:51:50 CST 2002


Could you tell what I am doing wrong? I want both variables to be evaluated 
using the switch statement. Why is it not working?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>Switch</title>
<div align = "center">
</head>
<body>
<script language = "JavaScript1.2" type = "text/javascript">
var sport, times= prompt("Which sport like to do best, skiing, skydiving, 
basketball, or football?", "Please choose one from the list")
prompt("How often do you do this, daily, weekly, or monthly?", "Please choose 
one from the list") 
    switch(sport, times){

    case "skiing" && "daily":
        document.write("You choose to ski daily");
        break;
    case "skiing" && "weekly":
        document.write("You choose to ski weekly");
        break;
    case "skiing" && "monthly":
        document.write("You choose to ski monthly");
        break;
    case"skydiving" && "daily":
        document.write("You choose to go skydiving daily");
        break;
    case"skydiving" && "weekly":
        document.write("You choose to go skydiving weekly");
        break;
    case"skydiving" && "monthly":
        document.write("You choose to go skydiving monthly");
        break;
    case"basketball" && "daily":
        document.write("You choose to play basketball daily");
        break;
    case"basketball" && "weekly":
        document.write("You choose to play basketball weekly");
        break;
    case"basketball" && "monthly":
        document.write("You choose to play basketball monthly");
        break;
    case"football" && "daily":
        document.write("You choose to play football daily");
        break;
    case"football" && "weekly":
        document.write("You choose to play football weekly");
        break;
    case"football" && "monthly":
        document.write("You choose to play football monthly");
        break;
    default:
        document.write("You didnt answer the questions!");
        break;
    }

    
</script>
</div>
</body>
</html>
Thanks for your help
Totally confused
Sheryl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20020124/a4aaef4b/attachment.htm>


More information about the Javascript mailing list