3
我有問題讓webshims插件畫布polyfill工作。webshim polyfill畫布將無法在IE7模式下工作
我收到以下錯誤IE9使用IE7模式:
SCRIPT438: Object doesn't support property or method 'fillRect'
problem.html, line 21 character 7
當我嘗試運行此代碼:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DealingTree</title>
<meta http-equiv="Content-type" content="text/html;charset=utf-8"/>
<script type="text/javascript" src="/js/modernizr.js"> </script>
<script type="text/javascript" src="/js/jquery.js"> </script>
<script type="text/javascript" src="/js/sssl.js"> </script>
<script type="text/javascript" src="/js/webshims/js-webshim/minified/polyfiller.js"> </script>
</head>
<body>
<canvas id="savings" height="350" width="700"> </canvas>
<script type="text/javascript">
//<![CDATA[
window.FlashCanvasOptions = { disableContextMenu: true };
$.webshims.setOptions('canvas', { type: 'flashpro' });
$.webshims.polyfill('canvas');
var canvas = $('#savings');
var context = canvas.getContext('2d');
context.fillStyle='#F00';
context.fillRect(0,0,700,350);
//]>
</script>
</body>
</html>
的問題發生了,我是否使用默認的(excanvas)或的FlashPro 。
更新:在我看來,getContext()返回一個jQuery對象而不是上下文。
請幫忙嗎?
這裏的該插件的主頁: http://afarkas.github.com/webshim/demos/index.html – 2011-05-20 15:36:39