我得到了这个 lil 文件
/* WaterBall API notification model by Makerimages*/
function WBNotification(x,y,icon,text)
{
this.background="/WBGraphics/WBNotification.png";
this.x=x;
this.y=y;
this.icon=icon;
this.text=text;
this.draw=function()
{
var canvas = document.createElement('canvas');
canvas.id="WBNotificationArea";
canvas.width=88;
canvas.height =43;
document.body.appendChild(canvas);
cvs=document.getElementById("WBNotificationArea");
var context=cvs.getContext();
context.drawImage(this.background,this.x,this.y);
}
return this;
}
我像这样使用它
site=new waterContainer();
site.notifications[0]=new WBNotification(10,10,null,"hello there!");
site.notifications[0].draw()
一切正常,但是 this.draw() 说(在 chrome 的脚本阅读中)它不能调用 null 的方法 drawImage,我该如何解决?