Javascript for checking whether the textbox is filled or not

rajesanthu 0 Tallied Votes 207 Views Share

NB:Excuse me Experts,,,This is only for beginners......
JAVASCRIPT FOR CHECKING WHETHER THE TEXT FILED IS FILLED OR NOT

Be noted that

1.The form given above is just for example
2.You can add your own form,,please dont forget to chenge the names in assignments as
you are going on your own forms.
3.The above illustrated in case there is only one text field
4.If there are more text fileds then you have to add more variables in script and
you should fix that much checks...


Try it,,,,,,

Its Your Friend...........
Rajeesh.N.Santhu

<html>
<head>
<title>
Inboxcheck
</title>
</head>
<body>
<form>
<input type="text" name="myname"/>
<input type="button" value="Ok" onclick="check(this.form)"/>
</form>
<script language="javascript">
function check(form)
{
 var urname=getElementbyId('myname')/*Getting the value entered in textfiled*/
 if(urname != "")/*Checking whether textfiled is numm or not*/
 {
   alert("Hello Welcome ",+form.myname.value)
 }
 else
 {
  alert("Please Fill in the field")
 }
}
</script>
</body>
</html>