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 5959971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:45:37+00:00 2026-05-22T18:45:37+00:00

I’ve been trying to do this to no avail :( From what I’ve researched,

  • 0

I’ve been trying to do this to no avail 🙁 From what I’ve researched, there are two ways to change the stated class value in JavaScript:

document.getElementById(v).setAttribute(attribute,value);

or

document.getElementById(v).className = value;

However, I tried both and they’re not doing it.

Here’s my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
  <head>
    <title>Checklist</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="/systems_hr/Style%20Library/globalstyles_test.css">
    <style type="text/css">
      #innerframe {
                width: 100%;
                height: 63em;
        }
    </style>
    <script type="text/javascript" src="/systems_hr/Style%20Library/JavaScripts/styles.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>    
    <script type="text/javascript">    
      /* I'll clean this one up. Didn't want to play nice with styles.js
      var x = 0;
      var p = new Array(3) 
      
      for (x = 1; x < 4; x++)
      {
        p[x] = new Image();
        p[x].src = "/systems_hr/onboarding/Custom%20Pages/Checklist%20EN/images/id1-" + x + ".png";
      } 
      */
      
      var p0 = new Image();
      p0.src = "images/id1.png";
      
      var p1 = new Image();
      p1.src = "images/id1-1.png";
      
      var p2 = new Image();
      p2.src = "images/id1-2.png";

      var p3 = new Image();
      p3.src = "images/id1-3.png";  
      
      var p4 = new Image();
      p4.src = "images/id2.png";
      
      var p5 = new Image();
      p5.src = "images/id2-1.png";
      
      var p6 = new Image();
      p6.src = "images/id2-2.png";

      var p7 = new Image();
      p7.src = "images/id2-3.png";    
      
      var p8 = new Image();
      p8.src = "images/id3.png";
      
      var p9 = new Image();
      p9.src = "images/id3-1.png";
      
      var p10 = new Image();
      p10.src = "images/id3-2.png";

      var p11 = new Image();
      p11.src = "images/id3-3.png";       
      
      var p12 = new Image();
      p12.src = "images/id4.png";
      
      var p13 = new Image();
      p13.src = "images/id4-1.png";
      
      var p14 = new Image();
      p14.src = "images/id4-2.png";

      var p15 = new Image();
      p15.src = "images/id4-3.png"; 
      
      function changeFrame (frameSRC)
      {
        var myFrame = document.getElementById('fraContent'); 
        myFrame.contentWindow.location =  frameSRC;
      }
      
      function changeTab(tab)
      { 
        alert(tab);  
        switch(tab)     
        {
          case 0:         
            document.getElementById("week1").className = "active";
            test('week1');
            document.getElementById("month1").className = "active"; 
            test('month1');        
            document.getElementById("day1").className = "current";   
            test('day1');  
          case 1:
            document.getElementById("day1").className = "active";
            document.getElementById("month1").className = "active";         
            document.getElementById("week1").className = "current";
          case 2:
            document.getElementById("week1").className = "active";
            document.getElementById("day1").className = "active";         
            document.getElementById("month1").className = "current";
        }  
          
      }
      
      function test(tab)
      {
        alert(document.getElementById.id + " " + document.getElementById(tab).className)
      }
    </script>

  </head>
  <body>
  <table border="0" width="100%">
  <tr>
    <td colspan="2" align="left">
      <div id="navcontainer">
        <ul id="navlist">
          <li><a href="#" class="active" id="day1" onclick="changeTab(0);">FIRST DAY</a></li>
          <li><a href="#" class="active" id="week1" onclick="changeTab(1);test('day1');test('week1');test('month1');">FIRST WEEK</a></li>
          <li><a href="#" class="active" id="month1" onclick="changeTab(2);">FIRST 30-DAYS</a></li>
        </ul>
      </div>
      <div id="page_viewer">
          <table border="0" width="1020px" cellpadding="0" cellspacing="0">
          <tr>
            <td>
              <img src="images/id1.png" style="border: 0px; width: 1000px; height: 72px;" alt="" usemap="#imgTabMap" name="imgTab">
                <map id="imgTabMap" name="imgTabMap">
                  <area shape="rect" alt="" title="" coords="7,11,166,60" href="" name="area1" onclick="changeFrame('D1.html')">
                  <area shape="rect" alt="" title="" coords="206,10,365,59" href="" target="_self" onMouseOver="changeImageSrc('imgTab','p1')" onMouseOut="changeImageSrc('imgTab','p0')" name="area2" onclick="changeFrame('D2.html')">
                  <area shape="rect" alt="" title="" coords="405,11,566,59" href="" target="_self" onMouseOver="changeImageSrc('imgTab','p2')" onMouseOut="changeImageSrc('imgTab','p0')" name="area3" onclick="changeFrame('D3.html')">
                  <area shape="rect" alt="" title="" coords="605,10,763,60" href="" target="_self" onMouseOver="changeImageSrc('imgTab','p3')" onMouseOut="changeImageSrc('imgTab','p0')" name="area4" onclick="changeFrame('D4.html')">
                  <area shape="rect" alt="" title="" coords="805,9,963,60" href="" target="_self" onMouseOver="changeImageSrc('imgTab','p4')" onMouseOut="changeImageSrc('imgTab','p0')" name="area5">
                  <!-- Created by Online Image Map Editor (http://www.maschek.hu/imagemap/index) -->
                </map>
            
            </td>
          </tr>
          <tr>
            <td width="100%">
              <iframe name="fraContent" id="innerframe" src="D1.html" frameborder="0" scrolling="no" width="1000px"></iframe>
            </td>
          </tr>
          </table>
      </div>
      </td>
    </tr>
  </table>
  </body>
</html>

I know there’s a lot of rough-around-the-edges code, but I’m pressed for time, and I’m not that well versed with JavaScript syntax yet.

Here are the specifics of my code and what I’m trying to accomplish:

I use a global css code for the site, so most of my declarations are stored there. I’ve made the javascript code in-house (so to speak) at the moment. If this works, though, I plan to add this to a global JavaScript repository for my site (the styles.js one). I added the jQuery with every intention of using it later on (I haven’t yet because I’m just trying to learn it at the moment).

Ok, now from what you see, this bit of code is just a tabbed interface. Here’s the CSS code for my tabs:

/* CSS Tabs */
#navlist {
        padding: 3px 0;
        margin-left: 0;
        border-bottom: 1px solid #778;
        font: bold 12px Verdana, sans-serif;
}

#navlist li {
        list-style: none;
        margin: 0;
        display: inline;
}

#navlist li a.active {
        padding: 3px 0.5em;
        margin-left: 3px;
        border: 1px solid #778;
        border-bottom: none;
        background: #DDE;
        text-decoration: none;
}

#navlist li a:link { color: #448; }
#navlist li a:visited { color: #448; }

#navlist li a.active:hover {
        color: #000;
        background: #AAE;
        border-color: #227;
}

#navlist li a.current {
        padding: 3px 0.5em;
        margin-left: 3px;
        border: 1px solid #778;
        border-bottom: 1px solid white;
        text-decoration: none;
        background: white;
        cursor: text;
}

#navlist li a.current:hover {
        background: white;
        border-bottom: 1px solid white;
        cursor: text;
        color: #448;
}

#navlist div #content {
        font-size: 1em;
}

The tabs are supposed to change the contents of the iframe on click. The problematic JavaScript code’s job is to just simply change the look of the clicked tab. In the above CSS code, that is the class named "current", while the default style is the class "active".

The code that’s supposed to handle the change is changeTab(tab). First, I’ve set all the tabs to the default class "active". When I click on the tab, changeTab is supposed to kick in (also onLoad, but I didn’t add that first). And that’s where I’m having problems. The class values aren’t changing on the target tab.

First, I added some catch codes just to see if the onClick event is functioning (the reason why I added the alert code in the changeTab function). Then, I added a code that lets me see the final values of the class attribute (the test(tab) function). It’s supposed to display the tag’s Id and the value of its class attribute.

When I tried it out, I do get the passed parameter in the changeTab, which tells me that onClick is functioning. But the test tells me that the tag is undefined. As such, the "current" class is being applied to the last tab ("month1") regardless of what tab I click.

My work browser is IE8, and since this is a company intranet site, I don’t need it to be compatible to other browsers as our company wants us to use IE exclusively for work-related tasks.

Please help 🙁 also, if you can recommend alternatives to what I’m doing, please feel free to give them 🙂

  • 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-05-22T18:45:38+00:00Added an answer on May 22, 2026 at 6:45 pm

    You’ve forgot to put break; in your cases:

    case 0: 
      ...
      break; 
    case 1: 
      ...
      break; 
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.