It's a bad idea to use the same ID for mutiple objects. It can work, but it can get you in trouble. document.getElementById( ) behaves differently in different browsers when there are multiple objects with the same id., for example.
And getElementsByClassName is not supported in all browsers, which is surely why you got the error from it.
But I'd still use class name instead of id for your purposes. I'd also *NOT EVER* use just a number as a class name or id. At least use a letter prefix. And, unless you have a really good reason, don't use Response.Write to create HTML with little actual ASP content. So:
Code:
' break out of ASP:
%>
<div class="C<%=branchId %>" style="display: none;">
,,,
And then:
Code:
function showDiv(mik)
{
// parens with options( ) only works in MSIE!!! Use [ ]
var c2show = 'C' + mik.options[mik.selectedIndex].value
var divs = document.getElementsByTagName('div');
for( i=0; i<divs.length; i++ )
{
var div = divs[i];
div.style.display = ( div.className == c2show ) ? "block" : "none";
}
}