umair mohsin

umair mohsin

  • 1.3k
  • 387
  • 64.8k

js question

Mar 8 2015 2:42 PM
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Login</title>
<script type="text/javascript">
function check()
{
var check = document.form1.terms;
if(!check.checked)
{
alert("you have to select somthing to proceed further");
return false;

}
if(check.checked)
{
alert(" you select " + check.value);
return true;
}
return true;


}
</script>
</head>
<body>
<h1>Login Form</h1>
<form method="post" onsubmit="check()" name="form1">

Username: <input type="checkbox" name="terms" >hello<br>
<input type="checkbox" name="terms">good morning<br>
<input type="checkbox" name="terms">say bye<br>

<input type="submit" value="Submit">
<input type="reset" value="Reset Form">
</p>
</form>
</body>
</html>
 
 
 
i want my code to return value which i select .this sould done by an alert box

Answers (2)