View Single Post
Old 12-16-2012, 02:55 AM   PM User | #6
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
An alternative using arrays:
Code:
function find_select() {
    var elems = ["ander", "ander2", "dutchcountries", "dutchcountries2",
                 "germancountries", "germancountries2"];
    var displays = [];
    displays[0] = ['none', 'none', 'none', 'none', 'block', 'block'];
    displays[1] = ['block', 'block', 'block', 'block', 'none', 'none'];
    displays[2] = ['none', 'none', 'none', 'none', 'none', 'none'];
    
    
    var index = (document.getElementById("NEDERLAND").selected) * 1 +
        (document.getElementById("DUITSLAND").selected) * 2;
    for (var i=0; i < elems.length; i++) {
        document.getElementById(elems[i]).style.display = displays[index][i];
    }
}
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote