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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:16:49+00:00 2026-06-12T18:16:49+00:00

I have this JavaScript code that sets a background color to the latest pressed

  • 0

I have this JavaScript code that sets a background color to the latest pressed link:

<script>
function changeClass(Index) {
    var ids = new Array(
        "null", "homenav", "coffeenav", "sidenav", "standnav",
        "dinnernav", "stoolsnav", "pedestalsnav",
        "galleriesnav", "pressnav", "factsnav", "contactnav"
    );
    var color = new Array(
        "null", "#c9a900", "#f32837", "#0085cf",
        "#00aa86", "#c99900", "c42695", "#617f90",
        "#4814a9","#71a28a","#ac27a9","#998f86"
    );
    var i = 1;
    var length = ids.length;
    while (i < length) {
        document.getElementById(ids[i]).style.backgroundColor = '#FFF';
        document.getElementById(ids[i]).setAttribute("class","blacklink");
        document.getElementById(ids[Index]).style.backgroundColor =color[Index];
        document.getElementById(ids[Index]).setAttribute("class","whitelink");
        i++;
    }
}
</script>

And I also have a table that looks like this:

<table width="100%" border="0" align="left" cellpadding="3" cellspacing="3" class="menyrad">
 <tr valign="middle" align="center">
  <td width="10%" id="homenav">
    <a href="framsida_test.html" onClick="changeClass(1)">Furniture home</a>
 </td>
 <td width="10%" id="coffeenav">
  <a href="coffee.html" onClick="changeClass(2)">Coffee tables</a>
 </td>
 <td width="9%" id="sidenav">
  <a href="side.html" onClick="changeClass(3)">Side tables</a>
 </td>
 <td width="9%" id="standnav">
  <a href="stand.html" onClick="changeClass(4)">Stand tables</a>
 </td>
 <td width="8%" id="dinnernav">
  <a href="dinner.html" onClick="changeClass(5)">Dinner tables</a>
 </td>
 <td width="6%" id="stoolsnav">
  <a href="stools.html" onClick="changeClass(6)">Stools</a>
 </td>
 <td width="8%" id="pedestalsnav">
  <a href="pedestals.html" onClick="changeClass(7)">Pedestals</a>
 </td>
 <td width="8%" id="galleriesnav">
  <a href="galleries.html" onClick="changeClass(8)">Galleries</a>
 </td>
 <td width="6%" id="pressnav">
  <a href="press.html" onClick="changeClass(9)">Press</a>
 </td>
 <td width="6%" id="factsnav">
  <a href="facts.html" onClick="changeClass(10)">Facts</a>
 </td>
 <td width="8%" id="contactnav">
  <a href="contact.php" onClick="changeClass(11)">Contact</a>
 </td>

The CSS for class="menyrad", class="whitelink" and class ="blacklink" looks like this:

.menyrad td {
  font-family:Verdana, Geneva, sans-serif;
  font-size:10px;
}

.whitelink {
  color:#fff;
  outline:0;
  font-weight:bold;
}

.blacklink a {
  color:#000;
  outline:0;
}

This works fine in all browsers BUT Internet Explorer (I checked with IE9, doesn’t seem to work in any version though). When I press any link the link gets a block of color around it, the text changes to bold white and there is no dotted outline around the pressed link. In IE the colored block shows up, but the text is black and not bold, and there is an outline.

What can I do?

  • 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-12T18:16:50+00:00Added an answer on June 12, 2026 at 6:16 pm

    Old versions of Internet Explorer (and modern versions when they are in Quirks/Compatibility modes) have a broken implementation of setAttribute. Don’t use it. Set the associated DOM property instead.

    element.className = "foo";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this simple code that speaks for itself. <script language='javascript"> function check() {}
I have this code: <script id=toModify > Invalid javascript that will cause errors </script>
I have this javascript code <Script> function getGroupId(){ var group=document.getElementById(selectedOptions).value; var groupFirstLetter=group.substring(2); } </Script>
I have this JavaScript code that sets the document.cookie but when running it I
I have this JavaScript code that creates a table, and puts in the rows
I have this javascript code below that uses jquery, it is suppoed to be
I have code that looks something like this in javascript: forloop { //async call,
I have a block of jquery / javascript code that sets the left margin
I have some JavaScript code that creates some div elements and it sets their
I have this Javascript code I inherited from another developer. I am very new

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.