Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

javascript dropdownlist

Ads

 
 

Share on Google+Share on Google+

Truth
javascript dropdownlist
1 Answer(s)      6 years and 2 months ago
Posted in : JavaScript Questions
I want to replace window.prompt with a textbox but it doesnt work,please help.

<script>
function addOption(Area){
oc = Area.options.length;
if(Area.selectedIndex==oc-1){
   newOpt = window.prompt("Enter Area","");
   if(newOpt+"">""){
     Area.options[oc] = new Option(Area.options[oc-1].text);
     Area.options[oc-1] = new Option(newOpt, newOpt, true, true);
   }
}
}
</script>
//dropdownlist
<select name="Area" id="Area" onchange="addOption(this)">
              <option value="Please Select">Please Select</option>
              <option value="Johannesburg">Johannesburg</option>
              <option value="Pretoria">Pretoria</option>
              <option value="Cape Town">Cape Town</option>
              <option value="Durban">Durban</option>
              <option value="Other Specify">Other Specify</option>
            </select>
Ads
View Answers

May 31, 2011 at 11:16 AM


<html>
<script>
function show(){
oc = Area.options.length;
if(Area.selectedIndex==oc-1){
document.getElementById('lab').style.visibility="visible";
document.getElementById('val').style.visibility="visible";
document.getElementById('b').style.visibility="visible";
   }
}
function addOption(){
oc = Area.options.length;
newOpt = document.getElementById('val').value;
Area.options[oc] = new Option(Area.options[oc-1].text);
Area.options[oc-1] = new Option(newOpt, newOpt, true, true);
document.getElementById('lab').style.visibility="hidden";
document.getElementById('val').style.visibility="hidden";
document.getElementById('b').style.visibility="hidden";
   }
</script>
<select name="Area" id="Area" onchange="show()">

              <option value="Please Select">Please Select</option>
              <option value="Johannesburg">Johannesburg</option>
              <option value="Pretoria">Pretoria</option>
              <option value="Cape Town">Cape Town</option>
              <option value="Durban">Durban</option>
              <option value="Other Specify">Other Specify</option>

            </select>
            <br><br>
            <label id="lab" style="visibility:hidden;">Enter Area</label><input style="visibility:hidden;" type="text" id="val" ><input type="button" id="b" style="visibility:hidden;" value="ok" onclick="addOption();">
</html>

Ads









Related Tutorials/Questions & Answers:
javascript dropdownlist
javascript dropdownlist  I want to replace window.prompt with a textbox but it doesnt work,please help. <script> function addOption(Area..., newOpt, true, true); } } } </script> //dropdownlist <select name
javascript validation
javascript validation  validation of comparing dropdownlist and textbox in javascript
Advertisements
DropDownList in Flex4
DropDownList control in Flex4: The DropDownList control contains a drop-down... to that of the SELECT form element in HTML. The DropDownList control consists... provide the data to the DropDownList control by using the DataProvider(<s
html dropdownlist code - JSP-Servlet
html dropdownlist code  hi how to get textfield in html when i select the option others in the dropdown list, pls provide the code?   Hi Friend, Try the following code: function show(){ var op
how to get data using dropdownlist, textbox and search button in jsp
how to get data using dropdownlist, textbox and search button in jsp  Hi, I want to display data using jsp,javascript and mysql. My Q. is If i select an entry suppose 'title' from dropdownlist and give a title name 'partial dif
JavaScript
JavaScript  clone JavaScript
display data from database on selecting option of dropdownlist
display data from database on selecting option of dropdownlist   Sir I want to display data from database by just selecting option of dropdown list without using any button in a table format and one more addtional question
display data from database on selecting option of dropdownlist
display data from database on selecting option of dropdownlist   Sir I want to display data from database by just selecting option of dropdown list without using any button in a table format and one more addtional question
display data from database on selecting option of dropdownlist
display data from database on selecting option of dropdownlist   Sir I want to display data from database by just selecting option of dropdown list without using any button in a table format and one more addtional question
display data from database on selecting option of dropdownlist
display data from database on selecting option of dropdownlist   Sir I want to display data from database by just selecting option of dropdown list without using any button in a table format and one more addtional question
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp  //Customer Name: <select name="name"> <% try{ Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp  Customer Name:<select name="name"> <% try{ Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc
javascript
javascript  javascript code to dynamically add table on button click.../javascript/javascriptexamples/javascript-add-row-dynamically.shtml http://www.roseindia.net/javascript/javascript-add-row-to-table.shtml http://www.roseindia.net
Javascript
Javascript  How validations are done using javascript ,with example? and interview questions on javASCRIPT
JavaScript
should use JavaScript? Thanks   Hi, JavaScript is scripting language that runs on browser. You have to embed JavaScript in HTML page. Please see JavaScript tutorial. Thanks
JavaScript
JavaScript  how to get full path of a file type in javascript
javascript
javascript  Hi deepak, how to write form validation on javascript
javascript
javascript  write a program to display implement about browsers using javascript
javaScript
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript
javascript
javascript  i have just learned javascript... can you tell me what kind of applications can be made by javascript?? thank you
how to get the values to dropdownlist from oracle database
how to get the values to dropdownlist from oracle database   </script> </head> <body> <select name='countryname' onchange="showState(this.value)"> <option value
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp  Can anybody tell me what is the problem in this code as i am not able to fetch the data from the database and set it into dropdown list in jsp please help <br/>
javascript
javascript  Hi sir, This is sinduri, i want to learn javascript, so plz can u help me.how to learn
javascript
javascript  how to set the request or session attribute in javascript head part of jsp page
javascript
javascript  hi sir, if i want to learn javascript. what concepts i want to know
JAVASCRIPT
JAVASCRIPT  I have one textbox and I want to validate that it must start with number(1-0). can anyone tell me a javascript for that ? thanks in advance
Javascript
Javascript   Javascript to check Numeric entry in checkbox.....   Hi Please find the following code for numeric entry validation in javascript function validateBox(){ var data=document.myForm.someText.value
javascript
javascript  hi, I was actually working on to calculate the number of days between two dates of yyyy-mm-dd format using javascript, and when i click on button then number of days should be display in textbox
javaScript
javaScript  . Print a table like below in JAVASCRIPT 5 x 1 = 5 5 x 2 = 10 ΓΆβ?¬Β¦ΓΆβ?¬Β¦ΓΆβ?¬Β¦. 5 x 20 = 100
javascript
javascript  passing javascript values to jsp   Hi Friend, Try the following code: form.jsp: <html> <script> function getMsg...;/script> <input type="button" onclick="getMsg();" value="Get Javascript value