Hi;
I want to add links on some of dynamic elements on list box. But I don't know how to do it. Below is my code, the links work only on static coding, what about the elements that are generated from array?
<script language="JavaScript">
var AUSTRIA = new Array("Dsche OHG","Attn: Mr. Wo Honger", "Bayerhamerstrasse 12bcc",
"A-5020 Salzburg", "Tel: +42 662 878891", "Fax: +42 662 879866","e-mail:
wolfgang.holzinger@yahoo.com",
"
www.hotmail.com");
var FISH = new Array("trout", "mackerel", "bass", "", "", "", "","");
var BIRDS = new Array("robin", "hummingbird", "crow", "", "", "", "","");
function swapOptions(the_array_name)
{
var numbers_select = window.document.the_form.the_examples;
var the_array = eval(the_array_name);
setOptionText(window.document.the_form.the_example s, the_array);
}
function setOptionText(the_select, the_array)
{
//for select box
for (loop=0; loop < the_select.options.length; loop++)
{
the_select.options[loop].text = the_array[loop];
}
}
function go()
{
box = document.the_form.the_examples;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = destination;
}
</script>
<form name="the_form">
<select name="choose_category" onChange="swapOptions(window.document.the_form.cho ose_category.options[selectedIndex].text);">
<option selected>AUSTRIA
<option>FISH
<option>BIRDS
</select>
<select size="12" name="the_examples" onChange="go()" multiple>
<option>Dsche OHG
<option>Attn: Mr. Wo Honger
<option>Bayerhamerstrasse 12bacc
<option>A-5020 Salzburg
<option>Tel: +42 662 874891
<option>Fax: +42 662 879866
<option value="
">e-mail:
wolfgang.holzinger@yahoo.com
<option value="<A href="http://www.hotmail.com">www.eeoarms.com">http://www.hotmail.com">
www.eeoarms.com
</select>
</form>
Thanks for your help!!!
