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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:33:32+00:00 2026-06-05T10:33:32+00:00

I tested the following code in IE, Chrome, and Firefox and it does not

  • 0

I tested the following code in IE, Chrome, and Firefox and it does not work in any of them. I have read several questions about similar problems but they have not offered solutions that fix my example.

I am trying to create a pause/play button that interfaces with JWplayer (I also want it to interface with flowplayer, once I get the button working) and the image will change depending on which image is currently there. I also have a stop button that stops the player completely and changes the image of the pause/play button to pause.

Here is my current code:

<script type="text/javascript">
function changeimg()
{
  var obj = document.getElementById('image1');
  var imgtag1 = '<img src=\'PLAY.png\'>';
  var imgtag2 = '<img src=\'PAUSE.png\'>';
  if(obj.innerHTML == imgtag2)
  {obj.innerHTML = imgtag1;}
  else
  {obj.innerHTML = imgtag2;}
  return;
}

function playimg()
{
  document.getElementById('image1').innerHTML = '<img src=\'PLAY.png\'>';
  return;
}

</script>

<div id="image1" href="#" onclick="changeimg(); jwplayer('mediaspace1').play(); jwplayer('mediaspace2').play(); jwplayer('mediaspace3').play(); jwplayer('mediaspace4').play();"><img src='PLAY.png'></div>
<div href="#" onclick="playimg(); jwplayer('mediaspace1').stop(); jwplayer('mediaspace2').stop(); jwplayer('mediaspace3').stop(); jwplayer('mediaspace4').stop();"><img src='STOP.png'></div>

The play/pause function works, and the first div WILL change into the pause img (so the javascript is going through) and it WILL change back into play if I click on the second div (stop function – triggers playimg() ) but it will not change back into the play image if I click on the pause button again.

For security reasons I can’t link the website, but any help would be appreciated

  • 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-05T10:33:33+00:00Added an answer on June 5, 2026 at 10:33 am

    It looks like all you really want to change is the SRC of the IMG tag, not necessarily the entire innerHTML. As machineghost mentions in his comment, there may be whitespace added or other changes to the full HTML that may make your comparison come out as false.

    However, you could check if obj.src == “PLAY.png” and set the SRC attribute directly. Something like this:

    function changeimg()
    {
      var obj = document.getElementById('image1');
      var img1 = 'PLAY.png';
      var img2 = 'PAUSE.png';
      if(obj.src == img2)
      {obj.src = img1;}
      else
      {obj.src = img2;}
      return;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why doesn't following code work correctly in FireFox 3.6? I have tested in IE7,
Why does the following code not work in Internet Explorer (I've only tested in
i have tested following code which might print 0 and 2 but it print
Why does height: 100% have no effect on #baz in the following code? How
Edit: On further examination Firefox does not seem to be doing this, but Chrome
Here's my code - This works in chrome, firefox and safari .. I have
I have tested the following code on w3schools.com ; however, when I tried it
Please advise.. In the following code(Tested. Will work fine) public class Exp_Test { public
Would someone kindly explain why the following bit of code works, I've tested it
Following is the Java Script code i have. //URL = http://dev.stage.com/restapi/vc/auth/sessions/login/ //parametersURL = user.login=******&user.password=******

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.