I have written some simple HTML code to enable selection from an 'auto' populated SELECT box. This is created in javascript and works fine.
I have another javascript function which selects from an array all the results that match the selection.
I would now like to display the results from that function to the side of the SELECT box.
I have tried various things without success so I am asking if there is a way to achieve this, and if so, how.
Here is my HTML
I have put the function populateItems() in the place where I would like it to appear, the question is, how do I do this.HTML Code:<form name="selectcategory"> <table border="0" width="100%"> <tr> <td> <select id='catSelect' name='category> </select> </td> <script type="text/javascript">populatecat(); </script> <td> <script>populateItems()</script> </td> </tr> </table> </form>
This is the javascript for the populateItems function
Code:function populateItems() { var cat = document.getElementById('catSelect').value; if (cat != ''){ var itemLineArray = item.split("|"); // Split into lines for (var loop = 0; loop < itemLineArray.length; loop++) { lineArray = itemLineArray[loop].split(":"); catCode = TrimString(lineArray[0]); itemName = TrimString(lineArray[1]); if (cat == catCode && catCode != '' ) { document.write(itemName+'<br>'); } } } }



Reply With Quote
Bookmarks