View Single Post
  #7 (permalink)  
Old 11-14-09, 10:34 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
HTML Code:
<script type="text/javascript">
document.write('<span id="test">Test</span>');
t=document.getElementById('test');
t.setAttribute('onclick',bork);  /* Set onclick attribute */
function bork(e)
{
alert('Bork');
}
</script>
As far as the duplicate issue - options:

Create an array that lists the items in the first select statement, as well as a flag to indicate whether the user selected them. If the user already selected the item, disregard reselections.

-- or --

Use the sort JavaScript sort() Method to sort the target array. That should make the search process quicker.

-- or --

Flatten the target array with JavaScript join() Method and search the resultant string.
Reply With Quote