Question : Javascript question on populating required field

I have this javascript.. however it is not sisplaying alerttxt parameter even though it is true

function validate_required(field,alerttxt1,alerttxt)
{
with (field)
  {
  if (value=null)
    {
    alert(alerttxt1);return false;
    }
  else
    {
    alert(alerttxt);
    return true;
    }

Answer : Javascript question on populating required field

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
<script>
function validate_required(field,alerttxt1,alerttxt)
{
//with (field) comment this out
  {
  if (field.value==null || field.value=="")
    {
       alert(alerttxt1);
	   return false;
    }
  else
    {
    alert(alerttxt);
    return true;
    }
  }
}

  </script>
 </HEAD>

 <BODY>
  <input type='text' id='name' value='aaa'>
  <input type='button' value='button' onclick="validate_required(document.getElementById('name'),'please enetr text',document.getElementById('name').value)">
 </BODY>
</HTML>
Random Solutions  
 
programming4us programming4us