<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>
|