Share on Google+Share on Google+

Truth
javascript dropdownlist
1 Answer(s)      5 years and 10 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>









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
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
Advertisements
javascript validation
javascript validation  validation of comparing dropdownlist and textbox in javascript
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
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
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
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/>
By dropdownlist retrive data from database and show in textbox in jsp.
By dropdownlist retrive data from database and show in textbox in jsp.  Hello Sir, I am doing project in jsp.I have to retrive data from database, when I select value from dropdownlist, and that data I want to show in textbox
Values from servlet into dropdownlist in jsp page using ajax
Values from servlet into dropdownlist in jsp page using ajax  1) jsp...; <script type="text/javascript"></script> <title>Country</title> <script type="text/javascript"> var htmlres; function
dynamic retrival of data from mysql database to dropdownlist in jsp
dynamic retrival of data from mysql database to dropdownlist in jsp  ... database to the dropdownlist in jsp. Example: 1st i want to display the list...="text/javascript"> function showEmp(name){ if(document.getElementById
JavaScript
JavaScript  clone JavaScript
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
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript
javascript
javascript  write a program to display implement about browsers using javascript
javascript
javascript  Hi deepak, how to write form validation on javascript
JavaScript
JavaScript  how to get full path of a file type in 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  i have just learned javascript... can you tell me what kind of applications can be made by javascript?? thank you
javascript
javascript  Hi sir, This is sinduri, i want to learn javascript, so plz can u help me.how to learn
javascript
javascript  hi sir, if i want to learn javascript. what concepts i want to know
javascript
javascript  how to set the request or session attribute in javascript head part of jsp page
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
Tutorials   
Java Spring Hibernate Struts Training code for programming How can I dynamically load user-entered data as content of jquery dialog? java webcam integration question java coding Fix Scrollbar position in a checkboxList after postback Information Save Alert Country wise redirection to files Interface in javascript connect database with javascript Zip Code ZipCode how to validate the email login How to play FLV video files on Ipad using HTML code or javascript code? Nitobi Grid is not working in IE10/IE11 jquery issue plese help RegEx Tree structure from json whose parents can be dragged and dropped from child newyorklife insurance getElementById not working javascript code for search in html file Implement The Skeleton Code Implement This Skeleton Code Mobile Automation using Appium Computer forensic application Java: Searching a string from doc files java linked list urgent !!! java linked list urgent!!! library management library management library management library management question Html form using JavaScript to display the table content java how to prevent no from unroundin off on clicking text box again in JSP and Jquery graph generation from xml design file display data from database in textbox when id entered in textbox Javascript Code for all fields how to get HTTP GET request value using javascript array Javascript Querry autocomplete(): Spring mvc with jquery: I am not getting correct value in the text filed. Please help me Create SpreadSheet same as excel using java applet Create SpreadSheet same as excel using java applet How to change focus among multiple select boxes? Write JQUERY Code Write JQUERY Code Converting jsp variable to java variable java

Ads

 
Advertisement null

Ads