Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- if select category then show subcategories of this selected category


daveVk - 1:35 am on Feb 24, 2013 (gmt 0)


Consider giving subcategory selects different names, having multiple selects with same name likely to cause problems. If same name is a must, add/remove options from single select based on category.

Place subcategory selects within div with id="subcats" in category value order, each select with style="display:none"

function changeSelect( selectNo ) {
var sels = document.getElementById("subcats").getElementsByTagName('SELECT');
for( var j=0; j<sels.length; j++ ) {
sels[j].style.display = none;
if ( j===(selectNo-1) { sels[j].style.display = ''; }
}
}


<select name="category" onchange="changeSelect( this.value )" >


Thread source:: http://www.webmasterworld.com/javascript/4548214.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com