PROMPT
--without alert
<!DOCTYPE html>
<html>
<head>
<title></title>
<head>
<body>
<script type="text/javascript">
function anu()
{
var age=prompt("What is your Age?");
//alert("Hello your age is "+ age);
}
</script>
<form>
<input type="button" value="click me" onclick="anu()">
</form>
</body>
</html>
--with alert
===================================================================
<!DOCTYPE html>
<html>
<head>
<title></title>
<head>
<body>
<script type="text/javascript">
function anu()
{
var yourage=prompt("What is your Age?");
var age=18;
var youngold=age-yourage;
if(youngold > 0)
{
alert ("you are still "+(age-yourage) +" years young to see adult movie");
}
else
{
alert("you can watch adult movie");
}
}
</script>
<form>
<input type="button" value="click me" onclick="anu()">
</form>
</body>
</html>
OUTPUT :
--without alert
<!DOCTYPE html>
<html>
<head>
<title></title>
<head>
<body>
<script type="text/javascript">
function anu()
{
var age=prompt("What is your Age?");
//alert("Hello your age is "+ age);
}
</script>
<form>
<input type="button" value="click me" onclick="anu()">
</form>
</body>
</html>
--with alert
===================================================================
<!DOCTYPE html>
<html>
<head>
<title></title>
<head>
<body>
<script type="text/javascript">
function anu()
{
var yourage=prompt("What is your Age?");
var age=18;
var youngold=age-yourage;
if(youngold > 0)
{
alert ("you are still "+(age-yourage) +" years young to see adult movie");
}
else
{
alert("you can watch adult movie");
}
}
</script>
<form>
<input type="button" value="click me" onclick="anu()">
</form>
</body>
</html>
OUTPUT :
No comments:
Post a Comment