This script I have been working on works when I test it standalone or on an online HTML testing website, but when I integrate it into my web page absolutely nothing works. I don't understand! Here is the page I have been working on integrating it into: straycreations.com/admin/support_newticket. The code that is in this snippet is the exact same as on this page, just loaded in to a table cell. Does anyone have some guidance? Thank you.
Copy paste this code into a fresh page to see what I am trying to do. Basically, I want to search through results of a dropdown menu using the text box (example enter "2" to bring all options in the dropdown menu with the number "2" in it to the top of the list). Then once you select the drop down choice you populate the text area by clicking the button. Please help i'm so stumped.. I appreciate it guys.Code:<script language="JavaScript" type="text/javascript"> <!-- function filtery(pattern, list){ if (!list.bak){ list.bak = new Array(); for (n=0;n<list.length;n++){ list.bak[list.bak.length] = new Array(list[n].value, list[n].text); } } match = new Array(); nomatch = new Array(); for (n=0;n<list.bak.length;n++){ if(list.bak[n][1].toLowerCase().indexOf(pattern.toLowerCase())!=-1){ match[match.length] = new Array(list.bak[n][0], list.bak[n][1]); }else{ nomatch[nomatch.length] = new Array(list.bak[n][0], list.bak[n][1]); } } for (n=0;n<match.length;n++){ list[n].value = match[n][0]; list[n].text = match[n][1]; } for (n=0;n<nomatch.length;n++){ list[n+match.length].value = nomatch[n][0]; list[n+match.length].text = nomatch[n][1]; } list.selectedIndex=0; } // --> </script> <form name="form1"> <select style="font-size: 10px; font-family: verdana;" name="menu"> <option value="#">Quick Links ...</option> <option value="This is for value no.1">Value No. 1</option> <option value="This is for value no.2">Value No. 2</option> <option value="This is for value no.3">Value No. 3</option> </select> <input style="font-size: 8pt; font-family: verdana;" value="Populate" type="button" onClick="document.form1.textareaaccept.value=document.form1.menu.value;"> <input type="text" name="yourTextField" onkeyup="filtery(this.value,this.form.menu)" onchange="filtery(this.value,this.form.menu)"> <br/> <textarea size="100px" name="textareaaccept" style="width:600px;height:400px;"> </textarea> </form>




Bookmarks