window.onload=function(  ){
    var txtA = document.getElementById("tarea");
    if(txtA != null){
        txtA.onblur=function(  ){
            if (this.value) { alert("Text area is empty");}
        };
    }
    var tfd = document.getElementById("tfield");
    /* An alternative:
    if(tfd != null && txtA != null){tfd.onblur = txtA.onblur; }
    */
    if(tfd != null){
        tfd.onblur=function(  ){
            if (this.value) { alert("Textbox is empty");}
        };
    }
}

function checkForm(yourform){
           if(yourform.namestring.value == "" ||
           yourform.namestring.value == null){
                            // Check for an empty string or null value
           alert("Please type in your name");
           return(false);
           }
           else{
              return(true);
           }
       }

