"news.west.cox.net" <se*********@cox.net> wrote in message
news:YgZjd.245349$a85.60139@fed1read04...
Forgive me, I am new to javascript ( about 1 week playing with it ). I am
proficient in C, perl, python, java, etc... but no javascript.
I wrote an applet about 1 million years ago that has dynamic drop down
menus.
I have a couple of C programs that take GET requested data and displays
matching results from a database query...
For example... www.mydomain.com/cgi-bin/getTypes?code=6 might display
76|45|54|122|449|2020 and getTypes?code=7 might display 88|22|32|66|92
Now, I want to get that data into my javascript so I can break it down and
populate a drow down menu.
How can I retrieve this data?
Thanks for any help JS gurus.
Will this help?
<html>
<head>
<title>getTypes.htm</title>
<script type="text/javascript">
function getTypes() {
var code = location.search;
code = code.charAt(code.length-1);
code = parseInt(code,10);
var list = new Array();
list[6] = "76|45|54|122|449|2020";
list[7] = "88|22|32|66|92";
var item = list[code].split("|");
var form = document.forms[0];
form.Item.options.length = 0;
for (var i=0; i<item.length; i++) {
form.Item.options[i] = new Option(item[i],i);
}
}
</script>
</head>
<body onload="getTypes()">
<form>
<select name="Item">
</select>
</form>
</body>
</html>
Except that you would invoke it by:
www.mydomain.com/cgi-bin/getTypes.htm?code=6
not
www.mydomain.com/cgi-bin/getTypes?code=6