[nycphp-talk] Need ideas on implementing this feature
Peter Simard
peter at panvox.net
Thu Sep 5 11:22:03 EDT 2002
Hello Tom,
That's the route I'm working throuhg right now, however, the
Javascript is giving me headaches. i hate the way JS does error
messages!
Have a peek at the function I'm writing to be called on each SELECT
onChange:
If you have any suggestions as to improvement please feel free
Pete
***************
function addToSelect(arr)
{
var oOption;
var len = document.forms[1].elements[0].options.length;
for(var t = 0; t < len; t++)
{
if(document.forms[1].elements[0].options[t].selected == true )
{
var text = document.forms[1].elements[0].options[t].value;
text = text.split(":");
alert(text[1]);
alert('Option index is: ' + document.forms[1].elements[0].options[t].index );
alert('Option value is ' + document.forms[1].elements[0].options[t].value);
for(var j = 0; j < arr.length; ++j)
{
if(text[1] == arr[j][0])
{
oOption = new Option(arr[i], arr[i]);
//alert(oOption);
document.forms[1].elements[0].add(oOption);
alert(oOption.text + ' is the text\
' + oOption.value + ' is the value.');
}
}
}
}
}
Regards.
--
Peter
mailto:peter at panvox.net
Mail management by:
The Bat! 1.61
More information about the talk
mailing list