Here you can find a number of examples on Java Script.Please find the various kinds of examples listed on the right side of this site. If you don't find anything on Java Script then please write to us or leave a commnet. We are pleased to help and find the solution of your problem.
Showing posts with label if. Show all posts
Showing posts with label if. Show all posts

Javascript: IF ELSE IF



<html>
<head>
<title>IFELSE</title>

<script language="javascript">
function checkage()
{
var age=f1.t1.value;
if(age>18)
document.write("Your age is greater than 18 years<br>");
else if(age==18)
document.write("Your age is 18 Years");
else
document.write("Yoru age is smaller than 18 years");
}
</script>

</head>
<body>

<form name="f1">
<input type="text" name=t1>
<input type="button" value="Check" onclick="checkage()">

</body>
</html>

Javascript: IF ELSE



<html>
<head>
<title>IFELSE</title>

<script language="javascript">
function checkage()
{
var num=f1.t1.value;
if(num%2==0)
alert("Your entered number is even number");
else
alert("Yuor enteres number is odd number");
}
</script>

</head>
<body>

<form name="f1">
<input type="text" name=t1>
<input type="button" value="Check" onclick="checkage()">

</body>
</html>
Google