Home Answers Viewqa JavaScriptQuestions Question on javascript

 
 


Rahul
Question on javascript
1 Answer(s)      2 years and 6 months ago
Posted in : JavaScript Questions

There will be two combo box in HTML form.If selecting in one combo box(ex:child id=1),the corresponding one to one matched value(ex:Child name=ashish) get selected automatically in another combo box.How to do this using JavaScript??? or any other way in web application???

View Answers

November 17, 2010 at 1:13 PM


Hello Friend,

In javascript, you can use the following code:

<html>
<h2>ComboBox</h2>
<script language="javascript">
var arr = new Array();
arr[0] = new Array("-select-");
arr[1] = new Array("A");
arr[2] = new Array("B");
arr[3] = new Array("C");
arr[4] = new Array("D");

function change(combo1){
var comboValue = combo1.value;
document.forms["form"].elements["combo2"].options.length=0;
for (var i=0;i<arr[comboValue].length;i++){
var option = document.createElement("option");
option.setAttribute('value',i+1);
option.innerHTML = arr[comboValue][i];
document.forms["form"].elements["combo2"].appendChild(option);
}
}
</script>
<form name="form" method="post"><select name="combo1"
    onchange="change(this);">
    <option value="0">-Select-</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    </option>

</select><br />
<select name="combo2">
</select></form>
</html>

Thanks









Related Pages:
Question on javascript
Question on javascript  This is not exactly what i wanted....If i enter in 2nd combobox as name of child then it should show child id in 1st combobox automatically and vice versa
Question on javascript
Question on javascript  There will be two combo box in HTML form.If... to do this using JavaScript??? or any other way in web application???   Hello Friend, In javascript, you can use the following code: <html> <
question
question  i used the following code to disable browser back page javascript:window.history.forward(1); but not worked .please give the correct code to disable back page using jsp or javascript
question
question  i need a simple javascript or jsp code to send message from one mail to another mail
question
question  i need a simple javascript or jsp code to send message from one mail to another mail
question
question  how to list images from a file and how to display that images as four different images in each row using jsp / javascript
question
question  how to loop table rows in javascript ,jsp ,i want to list four images in each rows from a file
JAVASCRIPT insert Question -
JAVASCRIPT insert Question  It is easy to transmit information from HOST program (in my case PHP program) to JAVASCRIPT insert. How may I reverse this, passing YES/NO information from a CONFIRM BOX back to the PHP program
javascript
javascript  how to create random question using javascript?   <html> <script> function displayQuestions...="button" value="Question" onclick="displayQuestions();"> <label id="lab">
Javascript & jsp
Javascript & jsp  Dear Sir, Thanks a ton for all your answers throughout.I asked this question long ago.This time i nedd it very urgent.I think...; Askquestions> Question and Answers Please help me.It is urgent this time
Javascript & jsp
Javascript & jsp  Dear Sir, Thanks a ton for all your answers throughout.I asked this question long ago.This time i nedd it very urgent.I think...; Askquestions> Question and Answers Please help me.It is urgent this time
java question
please help me in this how to connect css, images, javascript to header.jsp
Javascript & jsp
Javascript & jsp  Dear Sir, Thanks a ton for all your answers throughout.I asked this question long ago.This time i nedd it very urgent.I think it might be a short solution.How can i get the navigation link whilr traversing
What is JavaScript Variables ?
What is JavaScript Variables ?  Hi, My question is that What is Variable in JavaScript Programming Language. How to declare variables in JavaScript Program. Thanks
Javascript code
Javascript code  Dear Sir, Thank you a lot for your support throughout the process. Here again i am in a doubt.Can you please clarify? I have...,then it redirects it to Confirm.jsp.My question is how to show the page navigation
Javascript code
Javascript code  Thank you a lot for your support throughout the process. Here again i am in a doubt.Can you please clarify? I have a page called... it to Confirm.jsp.My question is how to show the page navigation details
Javascript code
Javascript code  Dear Sir, Thank you a lot for your support throughout the process. Here again i am in a doubt.Can you please clarify? I have a page...,then it redirects it to Confirm.jsp.My question is how to show the page navigation details
Issue with Javascript
using javascript that for the question we should get 4 options and for the each question we should find the correct answer. it would be displayed as multiple...Issue with Javascript  Hi I created arrays in javascript in following
javascript validation
javascript validation  my problem is following code is my form i want.... <html> <script src="combovalidate1.js" type="text/javascript" language="javascript"> </script> <body> <form name="form
What is javascript Arrays?
What is javascript Arrays?   Hi, I am learner of JavaScript. My question is that What is JavaScript Arrays ? How to Define the JavaScript arrays in you program. Please give an example show that i will try my self. Thanks
php,javascript,html
php,javascript,html  Hi, thank u for answered the previous question. one more question: when i register the student details, unique register number should be created and incresed automatically for every student based
Interview question - Development process
Interview question   Hi Friends, Can we create scriptless jsp, if so explain me how. can we access database by using javascript only
rtf_jsp_javascript
rtf_jsp_javascript  Hi every one plz give me answer for below question ASAP I created one JSP(used pre defined javascript in jsp to get rtf format in browser) which creats RTF Format in browser to enter data. MY question
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
Question
Question   When there is an exception in my program how java runtime system handles
question
question  dear sir/madam my question is how to compare two text format in java..we are java beginners..so we need the complete source code for above mentioned question...we have to compare each and every word
JavaScript
JavaScript  clone JavaScript
question
question  Dear sir i had some typing mistake at previous question so its my humble request to let me know the steps to start the tomcat6 under the tomcat directory
Dojo/Javascript - Ajax
Dojo/Javascript  Dojo/Javascript question: I get a message that ?dijit.byId is not a function? when debugging in firebug. I usually see dijit.byId embedded in an assignment (e.g. dijit.byId(?myId?).getValue();). So I don
JSP Login Page Question
JSP Login Page Question  hey..i have a login page where different users first registered and then after they can login. my question is how a user...="check.jsp" onsubmit="javascript:return validate();"> <table> <
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
question
question  Gud morning sir, I have asked u some question regarding jsp in saturaday for that i didnot find any answere in which u send me the some of the links.U have asked me the specify some details. There is a entity name
On HTML and JavaScript - Java Beginners
slection box using in javaScript Select Date and month using JavaScript -Select- 01 02 03 04 05 06 07 08 09 10 11 12 13... question is not clear. Now... -month- Jan Feb march April may jun
Question?
Question?  My question is how to: Add a menu bar to the program with a File menu. In the File menu, add a submenu (JMenuItem) called About. When the user clicks on the About menu item, display a JOptionPane message dialog
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
javascript - JSP-Servlet
, Please clarify your question. Thanks

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.