【在线求指教】javascript 函数加载疑问
本帖最后由 subsystemp 于 2014-03-29 00:01:12 编辑
var img = new Image();
img.src = "images/gg.jpg";
//画图方法
var VC_showimage = {
begin: function () {
var ts = {};
ts.image = null;
ts.start = function () {
ts.image.onload = function () {
ctx.drawImage(ts.image, 0, 290, 470, 470, 0, 0, 470, 470);
}
};
return ts;
}
};
//半透明遮罩层
var VC_zhezhao = {
begin: function() {
var ts = {};
ts.start = function () {
ctx.save();
ctx.fillStyle = "rgba(0, 0, 0, 0.5)";
ctx.fillRect(0, 0, 50, 50);
ctx.restore();
};
return ts;
}
};
//初始化
$(function () {
//1.加载图片
var showimg = VC_showimage.begin();
showimg.image = img;
showimg.sta