0
   

What is wrong in my code?

 
 
Reply Thu 24 Jan, 2013 11:06 am
<html>
<head>
<script type="text/javascript">
function checkAll()
{
var a = document.getElementById("name");
var b = document.getElementById("password");

if(a.value == "" || a.value == 0 || a.value == null)
{
document.getElementById("namemsg").innerHTML="Please Enter a value";
}
else if(b.value == "" || b.value == 0 || b.value == null)
{
document.getElementById("passmsg").innerHTML="Please Enter a value";
}
}
</script>
</head>
<body>
<form>
<table width="422">
<tbody>
<tr>
<td width="103">Name : </td>
<td width="146"><input name="name" id="name" onblur="checkAll()" type="text"></td>
<td width="157" id="namemsg"><br></td>
</tr>
<tr>
<td>Password : <br> </td>
<td><input name="password" id="password" onblur="checkAll()" type="password"> </td>
<td id="passmsg"><br> </td>
</tr>
<tr>
<td><br> </td>
<td><input name="submit" type="submit"> </td>
<td><br> </td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 725 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » What is wrong in my code?
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 05/14/2025 at 07:19:40