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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:52:15+00:00 2026-06-12T00:52:15+00:00

My Script var cwidth = document.getElementById(‘contentarea’).clientWidth; var elements = document.getElementsByClassName(shadow); for(var i=0; i<elements.length; i++)

  • 0

My Script

var cwidth   = document.getElementById('contentarea').clientWidth;
var elements = document.getElementsByClassName("shadow");

for(var i=0; i<elements.length; i++) {
   elements[i].style.width = cwidth+"px";
   var anc = elements[i].getElementsByTagName("a"); // not working in IE 7 & 8
   anc[0].style.width = cwidth+"px";
}

This script working well in all browsers except IE 7 & 8

Any one please help me

  • 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-12T00:52:17+00:00Added an answer on June 12, 2026 at 12:52 am

    getElementsByClassName isn’t supported in IE<9.

    In IE8 you can use:

    var elements = document.querySelectorAll(".shadow");
    

    But keep in mind that it’s not a live collection like the one you get with getElementsByClassName. And if you want to look for elements with multiple classes, you’ll have to do document.querySelectorAll(".first.second");.

    As for IE7, you have to rely on something else, like a weel known framework (like jQuery or just Sizzle), or a function like this:

    var getElementsByClassName = (function(all) {
        return function (cls) {
            var a = [], i = 0;
            for (; i < all.length; i++)
                if ((" " + all[i].className + " ").indexOf(" " + cls + " ") !== -1)
                    a.push(all[i]);
            return a;
        };
    })(document.all);
    

    This isn’t a live collection either, moreover you won’t be able to search for elements with multiple classes. That is, unless they are ordered like you want in their className property, but you can’t rely on that. You’ll have to do something more complicated, I’ll leave it to you when you’ll get more experienced in Javascript.

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

Sidebar

Related Questions

I have this simple script: var o = document.getElementById(content); if (o.clientHeight == 372) {
I have the following script: var before = document.getElementById('before'); if (switchElement.value == 'single'){ for
that's part of my script: var count = $(.sliderItem).length; if (count < lp +
In Firefox's and Chrome's consoles, this works (alerts script content): var script = document.createElement(script);
I have the following piece of HTML: <style type=text/css> #c{width:200px;height:500px} </style> <canvas id=c></canvas> <script
I've found this piece in a script var name = project.SMALL_WIDTH//p.containerWidth() /// 2//project.WIDTH /
Here is the script: var currentCat = all; $(document).ready(function(){ $(.categoryItem).click(function(event){ $(#browseBookArea).fadeToggle(100); currentCat = $(this).attr(id);
I have written this script: var elms = document.getElementsByTagName('li'); for (var i = 0;
I have an ASP.Net page that has a script:# var Show; $(document).ready(function () {
my script: var Url = 'http://readonline.egscans.com/Remnant/Chapter_036_[END]'; var response = UrlFetchApp.fetch(Url).getContentText(); I get this error

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.