JAVSCRIPTのナビゲーションバーマウスクリックで変色効果があります.






JAVASCRIPT            


window.onload = initLinkStyle;
function initLinkStyle() {
    if(document.getElementsByName('myset')){
        var arrLink = document.getElementsByName('myset');
        for(i = 0; i < arrLink.length; i++) {
            var link = arrLink[i];
            link.className='ts_sel';       
            link.onclick = clickNav;   
        }
    }
}
 
/**
 *       
 * @param {Object} event     
 */
function clickNav(event) {
    var target = event.currentTarget;   
     
    //     a   
    if(document.getElementsByName('myset')){
        var arrLink = document.getElementsByName('myset');
        for(i = 0; i < arrLink.length; i++) {
            var link = arrLink[i];
            if(link.className == 'ts_seled') {
                link.className = 'ts_sel';
            }
        }
    }
     
    target.className = 'ts_seled';
     
    return false;//         
}