dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: javascript IE bug

  1. #1
    Join Date
    Jan 2011
    Posts
    2

    Question javascript IE bug

    Hello, this is my first post here. I have encountered sth strange on my website. Every menu item is working fine except 3rd one, this is only IE problem.

    JS code:
    switch (str) {
    case 'main': {
    document.getElementById('a_home').className="active";
    document.getElementById('a_about_us').className="";
    document.getElementById('a_team').className="";
    document.getElementById('a_services').className="";
    document.getElementById('a_contact').className="";

    break;
    }
    case 'about_us': {
    document.getElementById('a_about_us').className="active";
    document.getElementById('a_home').className="";
    document.getElementById('a_team').className="";
    document.getElementById('a_services').className="";
    document.getElementById('a_contact').className="";

    break;
    }
    case 'team': {
    document.getElementById('a_home').className="";
    document.getElementById('a_about_us').className="";
    document.getElementById('a_team').className="active";
    document.getElementById('a_services').className="";
    document.getElementById('a_contact').className="";
    break;
    }
    case 'services': {
    document.getElementById('a_services').className="active";
    document.getElementById('a_home').className="";
    document.getElementById('a_about_us').className="";
    document.getElementById('a_team').className="";
    document.getElementById('a_contact').className="";
    break;
    }
    case 'contact': {
    document.getElementById('a_contact').className="active";
    document.getElementById('a_home').className="";
    document.getElementById('a_about_us').className="";
    document.getElementById('a_team').className="";
    document.getElementById('a_services').className="";
    break;
    }
    default: document.getElementById('a_'+str).className="";
    }

    I know this switch isnt the greatest solution for navigation, but i couldnt figure out anything better sice im kinda new to js

  2. #2
    Join Date
    Jan 2011
    Posts
    2
    and here is my navigation list of items

    <ul id="nav">
    <li id="home"><a id="a_home" href="javascript:;" onclick="showUser_tbl('main');"><span>Strona główna</span></a></li>
    <li id="about_us"><a id="a_about_us" href="javascript:;" onclick="showUser_tbl('about_us');"><span>O firmie</span></a></li>
    <li id="team"><a id="a_team" href="javascript:;" onclick="showUser_tbl('team');"><span>Zespół</span></a></li>
    <li id="services"><a id="a_services" href="javascript:;" onclick="showUser_tbl('services');"><span>Usługi</span></a></li>
    <li id="contact"><a id="a_contact" href="javascript:;" onclick="showUser_tbl('contact');"><span>Kontakt</span></a></li>
    </ul>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles