Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8794083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:12:17+00:00 2026-06-13T23:12:17+00:00

Okay so I inherited a site from a previous developer to make some upgrades

  • 0

Okay so I inherited a site from a previous developer to make some upgrades to. One thing that is annoying me (though not the client) is that a single tab is always the “.selected” tab, even when it is not actually selected. Technically I think it is “selected default”.

Site is rooferanchorage.com.

I tried just removing default from the last section in the .js but no effect. I am a total javascript illiterate as you can probably tell. I believe this is the relevant code – any suggestions on how I can make the selected class work correctly?

isSelected:function(menuurl){
    var menuurl=menuurl.replace("http://"+menuurl.hostname, "").replace(/^\//, "")
    return (tabdropdown.currentpageurl==menuurl)
},

    init:function(menuid, dselected){
        this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
        var menuitems=document.getElementById(menuid).getElementsByTagName("a")
        for (var i=0; i<menuitems.length; i++){
            if (menuitems[i].getAttribute("rel")){
                var relvalue=menuitems[i].getAttribute("rel")
                document.getElementById(relvalue).firstlink=document.getElementById(relvalue).getElementsByTagName("a")[0]
                menuitems[i].onmouseover=function(e){
                    var event=typeof e!="undefined"? e : window.event
                    tabdropdown.dropit(this, event, this.getAttribute("rel"))
                }
            }
            if (dselected=="auto" && typeof setalready=="undefined" && this.isSelected(menuitems[i].href)){
                menuitems[i].parentNode.className+=" selected default"
                var setalready=true
            }
            else if (parseInt(dselected)==i)
                menuitems[i].parentNode.className+=" selected default"
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:12:17+00:00Added an answer on June 13, 2026 at 11:12 pm

    On lines 72-73 of your source code is the following:

    //SYNTAX: tabdropdown.init("menu_id", [integer OR "auto"])
    tabdropdown.init("colortab", 3)
    

    Referencing the code in your question, you can see the condition in the init method which reads if (dselected=="auto" ... and will apparently check the href of the anchor inside the menu item against the URL to see if it’s the tab that should be selected.

    Currently your code is passing 3 which means it’ll be the 4th tab always – a zero-based index 0,1,2,3 which would explain why “Commercial” is always selected.

    Answer, try changing that 3 to "auto", or, if you are using static html files (for example if residential.html is an actual html file) try changing the integers to represent the tabs that should be selected for each one. Residential would be 2, for example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay guys, I've got one thats got me baffled. I've done some searching for
Okay, so I have this page, which has one Ajax:AsyncFileUploader also some other ajax
Okay, I am stumped on this one and need some quick help. I have
I've inherited some code that did something like this, Header: HeaderFile.h #ifndef HEADERFILE_H #define
Okay, next PHPExcel question. I have an HTML form that users fill out and
Okay, so I have my post.php page. If you are not logged in, you'll
okay, i'm setting up a multi-user chat system. i have a messages table, that
I am currently working on an inherited codebase. One of the critical missing pieces
Okay, here is my problem: I have a form that requires to have two
Okay my question is probably very simple for some of you but I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.