首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

——prototype 有关问题

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

求助——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了吗?

热点排行