Code for No Duplicates Drop Downs

liunx

Guest
I found a piece of code called No Duplicates posted at <!-- m --><a class="postlink" href="http://javascript.internet.com/forms/no-duplicates.html">http://javascript.internet.com/forms/no-duplicates.html</a><!-- m -->. I tried to contact the creator and received an invalid email.<br />
<br />
I love the functionality of this code and want to use it for a personal website. My project requires that I have 16 pull downs with 16 different values. Like the example, only one option can be selected for each pull down. Does anyone have code that might help me? Or can someone tell me how to create a circle reference that will accommodate? I am new at this stuff and any information would be appreciated.<br />
<br />
Thanks!<!--content-->function NoDups(nameSelect, value) {<br />
// number of selects. Note: define self if not DOM browser<br />
SelectElms=document.getElementById("MForm").getElementsByTagName("select").length; <br />
for(var i=0; i<SelectElms; i++) {<br />
if(document.MForm.name!=nameSelect) {// don't check selected<br />
for(var idx=0; idx<document.MForm.options.length; idx++) {<br />
if(document.MForm.options[idx].value==value) {// find selected option<br />
document.MForm.options[idx]=null;// remove it<br />
}<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
Add function to script, then change the onchange in all selects:<br />
<select name="Color_1" onChange="NoDups(this.name, this.options[this.selectedIndex].value)"><!--content-->
 
Back
Top