-1

Possible Duplicate:
How can I use the HTML5 canvas element in IE?

I'm not sure what I'm doing wrong. I did what it said to do but nothing works. I'm using a grid system, but I don't think that's the problem. And I don't think it's my security settings either. Here's my HTML and Javascript if that helps.

HTML

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Zack Vivier</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!--[if IE]><script type="text/javascript" src="js/excanvas.js"></script><![endif]-->
    <!-- enable HTML5 elements in IE7+8 -->
    <!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <![endif]-->
    <!-- 1140px Grid styles for IE -->
    <!--[if lte IE 9]><link rel="stylesheet" href="styles/ie.css" type="text/css" media="screen" /><![endif]-->
    <link href="styles/styles.css" rel="stylesheet" type="text/css">
    <link href="styles/1140.css" rel="stylesheet" type="text/css">
    <!--css3-mediaqueries-js - http://code.google.com/p/css3-mediaqueries-js/ - Enables media queries in some unsupported browsers-->
    <script type="text/javascript" src="js/css3-mediaqueries.js"></script>
    <script src="js/js.js"></script>
  </head>
  <body>
    <header>
      <h1 class="hidden">Zack Vivier Home</h1>
      <div class="container">
        <div class="row">
          <div class="fivecol">
            <div class="logo"><img src="images/logo.png" alt="zack vivier logo"></div>
          </div>
          <div class="sevencol last">
            <nav>
              <h2 class="hidden">Site Navigation</h2>
              <ul>
                <li><a href="index.html">Home</a></li>
                <li><a href="info.html">Information</a></li>
                <li><a href="portfolio.html">Portfolio</a></li>
                <li><a href="contact.html">Contact</a></li>
              </ul>
            </nav>
          </div>
        </div>
      </div>
    </header>
    <div class="container">
      <div class="row">
        <div class="twelvecol last">
          <div class="lineone"></div>
        </div>
      </div>
    </div>
    <div class="container">
      <div class="row">
        <div class="twelvecol last">
          <div class="caption">
            <h4 id="tagLine">Image Number</h4>
          </div>
          <div class="slideshow">
            <canvas id='showCanvas' width='1022' height='397'>Canvas Not Supported</canvas>
          </div>
        </div>
      </div>
    </div>
    <div class="container">
      <div class="row">
        <div class="threecol last">
          <div class="about"><h2>About Me</h2></div>
        </div>
      </div>
    </div>
    <div class="container">
      <div class="row">
        <div class="twelvecol last">
          <div class="linetwo"></div>
        </div>
      </div>
    </div>
    <div class="container">
      <div class="row">
        <div class="sevencol last">
          <div class="contenthome">
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; My Name is Zack Vivier; currently I am 19</p>
            <p>years old and attend Fanshawe College for Interactive</p>
            <p>Media Design and Production. I am a Designer,</p
            <p>Programmer, Musician, Video Editor, and Animator.</p>
          </div>
        </div>
      </div>
    </div>
    <h1 class="hidden">footer</h1>
    <div class="container">
      <div class="row">
        <div class="twelvecol last">
          <div class="footer">
            <h3>Copyright &copy; 2012 Zack Vivier. All Rights Reserved.</h3>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>

Javascript

// JavaScript Document
var imagePaths = new Array("images/photo_1.png", "images/game_web.jpg", "images/tattoo.jpg");
var whichImage = new Array("Graffti Project", "Game WebSite", "Tattoo Project");
var showCanvas;
var showCanvasCtx;
var imageText;
var currentImage = 0;
var currentImageText = 0;
var img = document.createElement("img");
function init() {
  imageText=document.getElementById('tagLine');
  showCanvas = document.getElementById('showCanvas');
  showCanvasCtx = showCanvas.getContext('2d');
  img.setAttribute('width','1022');
  img.setAttribute('height','397');
  switchImage();
  setInterval(switchImage, 2500);
}
function switchImage() {
  imageText.innerHTML = whichImage[currentImageText++];
  img.setAttribute('src',imagePaths[currentImage++]);
  img.onload = function() {
    if (currentImage >= imagePaths.length) {
      currentImage = 0;
      currentImageText = 0;
    }
    showCanvasCtx.drawImage(img,0,0,1022,397);
  }
  window.onload = init();
Community
  • 1
  • 1
zac
  • 45
  • 2
  • 10
  • 1
    Sentences start with a capital letter. – Piotr Dobrogost Dec 05 '12 at 08:07
  • And I'm takes an apostrophe, and `its` is the genitive form of it, not the contracted form of `it is` and Java has nothing to do with Javascript, and, and, and... – dda Dec 05 '12 at 08:09
  • What make you think IE8 supports the canvas element? See Browser support on http://www.w3schools.com/html/html5_canvas.asp – Emond Dec 05 '12 at 08:12
  • 1
    Emo, first of all w3schools isn't the place for this kind of information, they have been wrong before. And it explicitly says that IE9 has support for canvas, not IE8 – Stijn_d Dec 05 '12 at 08:15

2 Answers2

0

Canvas is a HTML5 element which IE8 doesn't supports. Your doctype is also wrong since you're using HTML5 set it to: "".

Dillen Meijboom
  • 963
  • 7
  • 13
0

As said in the comments: IE8 won't support the canvas tag. However there are some plugins that mimic it's behavior. I've used this one once: http://flashcanvas.net/ and it does the job, there's another called http://code.google.com/p/explorercanvas/. but i have no comment on that one, never used, don't know what to expect.

Just one note: the fallbacks will have their limitations, but as far as 2D drawing concerns, I think these will work out for you

Stijn_d
  • 1,078
  • 9
  • 20
  • yea i tried excanvas but it didnt work – zac Dec 05 '12 at 08:29
  • I've used flashcanvas for this application http://www.dessosports.com/nl/extra so perhaps you should try this one, and if you have trouble implementing these plugins you can perhaps add this code to your question or make a fiddle? – Stijn_d Dec 05 '12 at 08:33