fuxmyl
02-14-2003, 12:37 PM
I have a page and I'm using this script to populate a textbox from a drop down menu:
<script language="JavaScript"><!--
function updateForm(what,count) {
selected = what.partnumber1.selectedIndex;
value = what.partnumber1.options[selected].value;
for (var i = 0, oldpos = -1; i<count-1; i++) {
pos = value.indexOf('&',oldpos+1);
data = value.substring(oldpos+1,pos);
what.elements['description' + i].value = value.substring(oldpos+1,pos);
oldpos = pos;
}
what.elements['description' + i].value = value.substring(oldpos+1,value.length)
}
//--></script>
Here is the URL of the Page: http://in.northern-tech.com/quote/test_quote.asp
This works for the first drop down menu and text box, but when I try to get the next dropdown menu in line to populate the next text box then the first drop down menu stops working. The is the code I used to get the second box working:
<script language="JavaScript"><!--
function updateForm(what,count) {
selected = what.partnumber1.selectedIndex;
value = what.partnumber1.options[selected].value;
for (var i = 0, oldpos = -1; i<count-1; i++) {
pos = value.indexOf('&',oldpos+1);
data = value.substring(oldpos+1,pos);
what.elements['description' + i].value = value.substring(oldpos+1,pos);
oldpos = pos;
}
what.elements['description' + i].value = value.substring(oldpos+1,value.length)
}
function updateForm(what,count) {
selected = what.partnumber2.selectedIndex;
value = what.partnumber2.options[selected].value;
for (var i = 0, oldpos = -1; i<count-1; i++) {
pos = value.indexOf('&',oldpos+1);
data = value.substring(oldpos+1,pos);
what.elements['adescription' + i].value = value.substring(oldpos+1,pos);
oldpos = pos;
}
what.elements['adescription' + i].value = value.substring(oldpos+1,value.length)
}
//--></script>
Here is the URL that used this code: http://in.northern-tech.com/quote/test_quote1.asp
as you can see, the second drop down list now works but the first drowdown list stopped working. What am I doing wrong?
<script language="JavaScript"><!--
function updateForm(what,count) {
selected = what.partnumber1.selectedIndex;
value = what.partnumber1.options[selected].value;
for (var i = 0, oldpos = -1; i<count-1; i++) {
pos = value.indexOf('&',oldpos+1);
data = value.substring(oldpos+1,pos);
what.elements['description' + i].value = value.substring(oldpos+1,pos);
oldpos = pos;
}
what.elements['description' + i].value = value.substring(oldpos+1,value.length)
}
//--></script>
Here is the URL of the Page: http://in.northern-tech.com/quote/test_quote.asp
This works for the first drop down menu and text box, but when I try to get the next dropdown menu in line to populate the next text box then the first drop down menu stops working. The is the code I used to get the second box working:
<script language="JavaScript"><!--
function updateForm(what,count) {
selected = what.partnumber1.selectedIndex;
value = what.partnumber1.options[selected].value;
for (var i = 0, oldpos = -1; i<count-1; i++) {
pos = value.indexOf('&',oldpos+1);
data = value.substring(oldpos+1,pos);
what.elements['description' + i].value = value.substring(oldpos+1,pos);
oldpos = pos;
}
what.elements['description' + i].value = value.substring(oldpos+1,value.length)
}
function updateForm(what,count) {
selected = what.partnumber2.selectedIndex;
value = what.partnumber2.options[selected].value;
for (var i = 0, oldpos = -1; i<count-1; i++) {
pos = value.indexOf('&',oldpos+1);
data = value.substring(oldpos+1,pos);
what.elements['adescription' + i].value = value.substring(oldpos+1,pos);
oldpos = pos;
}
what.elements['adescription' + i].value = value.substring(oldpos+1,value.length)
}
//--></script>
Here is the URL that used this code: http://in.northern-tech.com/quote/test_quote1.asp
as you can see, the second drop down list now works but the first drowdown list stopped working. What am I doing wrong?