Hi!
I have written this function in javascript.
The problem I'm facing is that even when the text field in html form is empty, this function behaves as alert("");
. It must display "Enter some text" in alert box. The function, however, works well when I enter "Hello" in the text field and alert displays "Hello"
function interpret()
{
var a=null;
a=document.forms["input"]["box"].value;
if(a==null)
{
alert("Enter some text");
return false;
}
else
{
alert(a);
return true;
}
}
What is the problem here. Pleas help me out.