Advertisement
Guest User

dejx

a guest
Aug 18th, 2011
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. <script type="text/javascript">
  2.     window.onload = function () {
  3.         var canvas = document.getElementById('canvas');
  4.         if (canvas && canvas.getContext) {
  5.             var context = canvas.getContext('2d');
  6.             var myImage = new Image();
  7.             var cw = Math.floor(canvas.clientWidth);
  8.             var ch = Math.floor(canvas.clientHeight);
  9.             canvas.width = cw;
  10.             canvas.height = ch;
  11.             myImage.onload = function () {
  12.                 context.drawImage(myImage, 0, 0, cw, ch);
  13.             }
  14.             myImage.src = "content/bg.jpg";
  15.  
  16.         }
  17.     }
  18. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement