Posts

Showing posts from July 24, 2010

make drop down list in javascript example

Make dynamic drop down list in java script. <html> <head> <script> function makeDropDown(){     var formDiv = document.getElementById("div");     var selectTag=document.createElement("select");     selectTag.appendChild(getOption("First Value", "First Text"));     selectTag.appendChild(getOption("Second Value", "Second Text"));     formDiv.appendChild(selectTag); } function getOption(value, text){     var optionTag = document.createElement("option");     var text = document.createTextNode(text);     optionTag.setAttribute("value", value);     optionTag.appendChild(text);     return optionTag; } </script> </head> <body onload="makeDropDown()"> <div id="div"></div> </body> </html>

Drop Down List select box in javascript

Select index dropdown list in java script. Selected value in dropdown list and find all value from drop down list in javascript. <HTML>  <HEAD>   <script>     function findSelectedIndex(objList){         alert(objList.selectedIndex)     }     function findSelectedValue(objList){         alert(objList.value)     }     function findAllValues(objList){         var text = "";         for(var i=0; i<objList.length; i++){             text += objList[i].value+", ";         }         alert(text);     }   </script>  </HEAD>  <BODY>     <select id="list">     ...

Mobile No Validation javascript

How to validate mobile no in java script. <HTML> <head>     <script>     function ToCellValidate(objText)     {         if(objText.value!="")         {         if(objText.value.length < 9 || objText.value.length > 15 || objText.value.search(/[^0-9\-()+]/g) != -1 )         {         alert('Please enter valid mobile number');         objText.focus();         objText.value.value="";         return false;         }         else{         alert("valid mobile number");         return true;         }     ...

Recent Post

Recent Posts Widget