hi, try it like this:
<input name="crm_surname" id="crm_surname" type="text" size="20" maxlength="200" style="width: 200px;" /><label>*</label>
<label id="nameRequired" style="display: none;">
name is required</label>
<button onclick='checkNameRequired();'>button</button>
function checkNameRequired() {
var txtName = document.getElementById("crm_surname");
var nameRequired = document.getElementById("nameRequired");
if (txtName == "") {
nameRequired.style.display = "";
return false;
}
else {
nameRequired.style.display = "none";
}
return true;
}