4 Replies Latest reply on May 11, 2010 5:14 PM by Sketchsta

    Links and IE8 issue!!

    Sketchsta Level 1

      Hi all.

      First of all, this may not be the best place to ask about this, but its the only forums I use.

       

      The problem is links with javascript attributes not working in IE8, but work fine in Firefox. I've googled for the past few hours and have found that many are having similar problems, but I havent found any solutions that work for me.

      Maybe its something really simple that im overlooking, so i'll paste the whole code.

       

      Thanx in advance.

       

      heres the function:

      <script type="text/javascript">
      function showdiv(pass) {
      var divs = document.getElementsByName('short_container');
      for(i=0;i<divs.length;i++){
      if(divs[i].id.match(pass)){//if they are 'see' divs
      if (document.getElementById) // DOM3 = IE5, NS6
      divs[i].style.display="block";// show/hide
      else
      if (document.layers) // Netscape 4
      document.layers[divs[i]].display = 'block';
      else // IE 4
      document.all.divs[i].display = 'block';
      } else {
      if (document.getElementById)
      divs[i].style.display="none";
      else
      if (document.layers) // Netscape 4
      document.divs[i].display = 'none';
      else // IE 4
      document.all.divs[i].display = 'none';
      }
      }
      }
      </script>
      

       

      and the html link:

      <a href="javascript:showdiv('home')">Home</a>
      
        • 1. Re: Links and IE8 issue!!
          hans-g. Adobe Community Professional & MVP

          Hi,

           

          I would like to try a support, as for me it would be better you would send the link to this website in question.

           

          Hans-G.

          • 2. Re: Links and IE8 issue!!
            Sketchsta Level 1

            Hi Hans-G

            Thanx for the reply.

            There are no other issues on the page except the links not working in IE8 (even in compatibility mode). I did however come across some topics on getElementsByName() and how it is not suported in IE8 =(

            I think thats where the problem is.

            But as you can see...I can't exchange 'name' for 'ID' because my function needs both. The 'name' attribute is to Hide all divs, and 'ID' to show the clicked div.

             

            Have you got enough javascript experience to give me some tips on how to get this to work without getElementsByName() ??

            • 3. Re: Links and IE8 issue!!
              bemdesign Level 4

              You may want to try jQuery [http://jquery.com/], a popular JavaScript framework, to abstract away the JavaScript support issues (i.e. it works around the IE limitations). They also have useful tutorials to help get you started.

              • 4. Re: Links and IE8 issue!!
                Sketchsta Level 1

                Thanx bemdesign. I have actually seens afew jQuery files every now and then...and even went cross-eyed trying to read one of them.

                I wasnt aware that they had a website, thanx for the link. I'll definately look into it and see what it's all about.

                 

                But for now, this function is kinda urgent...and even tho it may not be the best approach, it will have to do. I have spent too much time on this and I need to get it done. I dont like deadlines sometimes =(