ThemeShaper Forums » Thematic

[closed]

Javascript inside of individual posts.

(1 post)
  • Started 9 years ago by hubs
  • This topic is not resolved
  1. When I add this to a post
    '<canvas id="canvas" width="700" height="525" style="border:0px;">
    Your browser does not support the canvas element.
    <script type="text/javascript">
    var c=document.getElementById("myCanvas");
    var cxt=c.getContext("2d");
    cxt.fillStyle="#FF0000";
    cxt.fillRect(0,0,150,75);
    </script>
    </canvas>'

    it doesn't work. It doesn't display the javascript part if the code. But when I call in the javascript like this:

    '<canvas id="canvas" width="700" height="525" style="border:0px;">
    Your browser does not support the canvas element.
    <script type="text/javascript" src="http://www.artifacting.com/blog/wp-content/uploads/2011/08/rooster.js"></script>
    </canvas>'

    it works fine. Could anybody tell me how to make it so individual posts with javascript in them work (versus making a seperate JS file that needs to be called in).

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.