Monday, September 10, 2012

Events example in Javascript

Event Sample



<html>
<b><center>CUSTMER INTERACTION FORM</center></b>
<script languge="Javascript">
function evaluate(form)
{
if(document.forms[0].elements[0].checked="True" && 
 document.forms[0].elements[1].checked="True")
{
var num = prompt("How many children?");
if (num >= 2)
alert("You are eligible for a loan of rs 10000/-");
else
alert("You are eligible for a loan of rs 5000/-");
}
else
document.writeln("<br><h1>Not eligible!!</h1>");
}
</script>
<body>
<form method = post>
Name    : <input type = text><br>
Address : <input type = text><br>
Age     : <input type = text><br>
</form>

<form method = post>
Marital status : <input type = checkbox><br>
Children(y/n) : <input type = checkbox><br>
Evaluate :<input type = "submit" value = "Submit"
onClick ="evaluate(this.form)";
</form>
</body>
</html>

0 comments:

Post a Comment