Develop a new think

Textbox

An effective way of performing script input and output operations is through use of textbox fields. You can use textboxes, <input type="text"/>, as input areas into which users enter information, and you can use them as areas to display script output.

Textbox Blank or not

How to check the textbox value is blank or not


function CheckTextboxBlank(){
	 if(document.getElementById("textbox1").value==""){
	    alert("Oops...blank text box");
    }else{ 
	    alert("Good!...text box is not blank");
    }
 }
</script>

  <input type="text" value="" id="textbox1" />
  <input type="button" value="check" onclick="CheckTextboxBlank();" /><br />
  

Textbox Value is number or Text

How to check the textbox value is Number or text


<script>
function CheckTextboxNumber(){
if(!document.getElementById("textbox2").value==""){
var obj=isNaN(document.getElementById("textbox2").value);
if(obj){
alert("Text");
}else{
alert("Number");
}
}
else
alert("please enter something...");
}
</script>

<input type="text" value="" id="textbox2" />
<input type="button" value="check" onclick="CheckTextboxNumber();" /><br />

 
web counter