function Validate(){
var txtName=document.getElementById("txt_name") ;
var button=document.getElementById("btnValidate");
var form=document.getElementById("testform");
if(txtName.value.trim()==""){
var label=document.createElement("label");
label.setAttribute("for","txt_name");
form.insertBefore(label,button);
txtName.labels[1].innerHTML="请输入姓名";
txtName.labels[1].setAttribute("style","font-size:9px;color:red;");
}
}
</script>