Page 325 - Web Applications (803) Class 11
P. 325
case "pasta": document.write("Pasta is 80 rupees<br>");
break;
case "chowmein": document.write("Chowmein is 100 rupees<br>");
break;
default: document.write("Any other food is not available")
}
</SCRIPT>
</BODY>
</HTML>
Output:
When you click on the “OK” button, with the message “This page says”. Then a new window appears as shown below:
Lab Assignment ‘n Activity Computational Thinking
1. Predict the output for the following code:
<HTML>
<BODY>
<SCRIPT>
//Calculate area or circumference of circle depending on user choice
var radius = prompt("Enter radius of circle");
var choice = parseInt(prompt("Enter 1 to calculate area 2 for circumference"))
document.write(“Radius Entered: "+radius+"<br> <br>");
switch (choice) {
case 1: circle_area=3.14*radius*radius;
document.write("Area of Circle "+circle_area+"<BR>");
break;
Introduction to Dynamic Websites Using JavaScript 323

