Image not displaying in html table

Status
Not open for further replies.

mitzi

Baseband Member
Messages
53
Hi guys,

I'm currently working off a php inc file. There's a bit of javascript in this file also.

I have a table and in the table there is a link (when I click Play the image above plays, and I click pause it stops).

All I want to do is insert image buttons for play and pause however no matter what way I put them in, they will not display. I've even tried creating an images folder within my directory on the hosting set up and this has not worked either.

Here is my code:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>EEG</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  </head>
  <style>
      #image
      {
        background-image: url("<?= $img ?>");
        background-repeat: no-repeat;
        width: <?= $width ?>px;
        height: <?= $height ?>px;
      }

      #startstop
      {
	  width: <?= $width ?>px;
	font-size: 20px;
	color: #000000;
	font-family: Arial;
      }

      .link
      {
	  cursor: pointer;
      }


      .help
      {
        display: block;
      }



  </style>
  <body onload="initAutoChange()">

      <script language="javascript">


        var autoChange = false; //set it to false if you don't want autoChange to work
        var autoChangePeriod = 4000; //in milliseconds
        
        var maxPages = <?= $maxPages ?>;
        var dir = '<?= $dirname ?>';
        var page = 1;
        var uniqid = '<?= uniqid() ?>';

        var timeout;

        function initAutoChange()
        {
            if (!autoChange)
            {
                return;
            }
            
            timeout = setTimeout('change()', autoChangePeriod);
        }

        function start()
        {
            autoChange = true;
            timeout = setTimeout('change()', autoChangePeriod);
        }

        function stop()
        {
            autoChange = false;
            clearTimeout(timeout);
        }




        function change()
        {
            if (!autoChange)
            {
                return;
            }
            next();
            timeout = setTimeout('change()', autoChangePeriod);
        }


        function previous()
        {
            
            if (page == 1)
            {
                return false;
            }
            page--;
            var img = document.getElementById('image');
            img.style.backgroundImage = "url(" + dir + page.toString() + ".gif?" + uniqid + ")";
            return false;
        }

        function next()
        {
            if (page == maxPages)
            {
                return false;
            }
            page++;
            var img = document.getElementById('image');
            //img.backgroundImage = dir + page.toString() + ".gif?" + uniqid;
            //img.setAttribute('backgroundImage', dir + page.toString() + ".gif?" + uniqid);
            img.style.backgroundImage = "url(" + dir + page.toString() + ".gif?" + uniqid + ")";
            return false;
        }


      </script>

      <table id="image" >
          <tr>
              <td width="10%" class="link" onclick="previous()">
                   
              </td>
              <td width="80%"></td>
              <td width="10%" class="link" onclick="next()">
                   
              </td>
          </tr>
      </table>

      <table id="startstop">
          <tr>
              <td width="50%" align="center" onclick="start()">
                  <a href="#" onclick="return false;"><img src="Play_Button.png alt="" border="0" /></a>

              </td>
              <td>

              </td>
              <td width="50%" align="center" onclick="stop()">
                <a href="#" onclick="return false;"><img src="Pause_Button.png alt="" border="0" /></a>
              </td>

          </tr>
      </table>

  </body>
</html>

Any help is appreciated, thanks!
 
your missing a double quote after the button.png

Pause_Button.png"

the last quote is NOT there, in the image tag
 
your missing a double quote after the button.png

Pause_Button.png"

the last quote is NOT there, in the image tag

Hi Larry,

thanks for the reply.

that quote was my fault, I quickly typed it in before I posted. Even with the quote mark in it doesn't work at all.

It actually seems to completely ignore the <img> tag. If I include an alt text, it just displays that. If I don't include any alt text it just displays nothing at all.
 
Try using the full url of the image as your src attribute (you'll probably find that you're looking in the wrong directory). The alt text is supposed to appear when the image cannot be displayed so it is not surprising that it is showing in your case.
 
Status
Not open for further replies.
Back
Top Bottom