You are on page 1of 6

Assignment-10

Alert box

<!DOCTYPE html>
<html>
<head>
<title> Using alert box </title>
</head>
<body>
<h1>Showing the alert box</h1>
<script type="text/javascript">
alert("Hello I Am Alert Box");
</script>

</body>
</html>
Assignment-10
Output

prompt box
<html>
<head><title>prompt box</title></head>
<body>
<h1>accepting your name using prompt box</h1>
<script type="text/javascript">
var name=prompt("Please enter your name: ");
if (name=="") name="visitor";
{
document.write("hi"+name+"welcome to
javascript");
}
Assignment-10

</script>
</body>
</html>
Output

Conform box
<html>
<head><title>conform box</title></head>
<body>
<script type="text/javascript">
var qry=confirm("are you sure to send this file to
recycle bin ?");
Assignment-10
if(qry)
document.write("welcome to java script <br> you
have moved this file to recycle bin");
else
document.write("welcome to java script<br>the file
is not moved ");
</script>
</body>
</html>
Output

Using for loop


<html>
<head><title>using for loop</title></head>
<body>
<h1>Using the loop in the script</h1>
Assignment-10
<script type="text/javascript">
var number;
document.write("Even numbers from 0 to 10<br>");
for(number=0;number<=10;number=number+2)
{
document.write(number+"<br>");
}

</script>
</body>
</html>
Output
Assignment-10

You might also like