home *** CD-ROM | disk | FTP | other *** search
-
- <ccresource>
- <cctitle>
- Drop Down List Search
- </cctitle>
- <cccategory>
- Browser
- </cccategory>
- <ccDescription>
- This code will allow the visitor to search a drop down box listing. Perfect for those who have very long lists.
- </ccdescription>
- <ccinstructions>
- The code goes both within the HEAD and BODY tags. You can change the items in the dropdown menu to suit your needs.
- </ccinstructions>
- <ccheadcontent>
- <SCRIPT LANGUAGE="JavaScript">
-
- <!-- Begin
- function promptSearch (thisform, thisfield) {
- var elnum = parseInt(-1);
- var k = parseInt(-1);
- for (var j = 0; j < document.forms[thisform].elements.length; j++) {
- if (document.forms[thisform].elements[j].name == thisfield) {
- elnum = j;
- break;
- }
- }
- var myvar = "";
- var srch = "";
- var menuLength = "";
- menuLength = eval("document." + thisform + "." + thisfield + ".length");
- srch = prompt("Search this drop down menu for...", "");
- if (srch ) {
- srch = srch.toUpperCase();
- for (var i = 0; i < menuLength; i++) {
- myvar = eval("document." + thisform + "." + thisfield + ".options[" + i + "].text.toUpperCase()");
- if (myvar.indexOf(srch) >= 0) {
- document.forms[thisform].elements[elnum].options[i].selected = true;
- break;
- }
- }
- }
- return false;
- }
- // End -->
- </script>
- </ccheadcontent>
- <ccbodycontent>
-
-
- <center>
- <form name=myform action="">
- <select name=menu1 size=1 onFocus="promptSearch(this.form.name, this.name)">
- <option>a1
- <option>a2
- <option>a3
- <option>a4
- <option>a5
- <option>a6
- <option>a7
- <option>a8
- <option>a9
- <option>a10
- <option>a11
- <option>a12
- <option>a13
- <option>a14
- <option>a15
- </select>
- </form>
- </center>
-
-
- </ccbodycontent>
- <ccelementcontent>
-
- <ccelementname></ccelementname>
- <ccelementaction></ccelementaction>
-
- </ccelementcontent>
- <ccextradata>
-
- </ccextradata>
- </ccresource>
-