I have the following script that I picked up which loads the days of the week into a drop down list. Depending on the day picked, it shows times. Script is as follows:
It shows/hides content based off a class name of "timeInput" as shown below:Code:function getElementsByClass(searchClass,node,tag) { var classElements = new Array(); if (node == null) node = document; if (tag == null) tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); for (i = 0, j = 0; i < elsLen; i++) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; } } return classElements; } var hsInputs; function resetInputs() { for (x in hsInputs) { hsInputs[x].style.display = "none"; } } function setHsInputs() { hsInputs = getElementsByClass("hsInput"); resetInputs(); } function hsOptions(input) { resetInputs(); if (input.value) { hsInputs[input.selectedIndex-1].style.display = "block"; } }
<p class="timeInput">Monday Timesbr/>
<input type="radio" name="times" value="9am">
9am<br />
What I was wondering, is there a way to modify this script so that I can show/hide a table row based off just one value from the drop down list?
Test file is at: http://midwestwebdesign.net/test.html
Any suggestions would be appreciated.





Bookmarks