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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:20:48+00:00 2026-05-16T00:20:48+00:00

I have this JavaScript on my page to toggle a div and switching between

  • 0

I have this JavaScript on my page to toggle a div and switching between two images

<script type="text/javascript">
 function toggleArchiv() {
  document.getElementById('cat').toggle();
  var image = document.getElementById('arrow');
  if (image.src == 'bullet_arrow_down.png')
   {
    image.src = 'bullet_arrow_up.png';
   }
   else
   {
    image.src = 'bullet_arrow_down.png';
   }
  }
</script>

Works fine on modern browsers, but IE keeps saying there is an error at that line

document.getElementById('cat').toggle();

So it doesn’t toggle the div and neither switches the image. What to 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-05-16T00:20:48+00:00Added an answer on May 16, 2026 at 12:20 am

    It looks to me like you’re using the PrototypeJS library. The library will add methods to DOM elements, in this particular case it’s adding HTMLElement.prototype.toggle. DOM prototyping is only supported in IE8 and later and it must be rendering in standards mode. In order to get it working in all browsers, use the $() method instead of getElementById():

    $('cat').toggle();
    

    http://api.prototypejs.org/dom/element/toggle/

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

Sidebar

Related Questions

Okay, I have this code: <script language=javascript type=text/javascript> <!-- function requestPage(page) { var request
I have a PHP File with something like this: <script type=text/javascript> var page =
I have this Javascript: <script language=javascript type=text/javascript> $().ready(function() { $('#ex2').jqm({ajax: 'view.php?id=<?=$objResult[id];?>', trigger: 'a.ex2trigger'}); });
I have a javascript toggle function: <script type=text/javascript> function toggle(layer) { var d =
I have this script: <script type=text/javascript> $(document).ready(function(){ $('#openframe').click(function() { $('#holder').fadeOut(500); $('#framer').fadeIn(500); }); }); </script>
I have this Javascript/JQuery code: <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js></script> <script type=text/javascript> name = $(#name).val(); alert(Name:
I have this script on my html page: <script language='javascript'>parent.resizeTo(550,510);</script> I'd like to add
I have the following Javascript code add_num = { f: function(html, num) { alert(this.page);
I have a javascript page which checks an email and username, this works fine
I have a problem with JavaScript magic. When I execute this code: var page

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.