日期:2014-05-16  浏览次数:20464 次

求助——prototype 问题
为什么HTML5 CANVAS对象  context对象 的prototype属性  不能通过这种方法拓展对象的方法

var canvas=document.getElementById('test');
context = canvas.getContext('2d');
context.prototype.ttt=function(){
alert('s');
}

上面代码运行出错

Uncaught TypeError: Cannot set property 'ttt' of undefined 
prototype html5 canvas

------解决方案--------------------
不是告诉你了context.prototype是undefined了吗?