开发者

why can't I assign properties to a new Image object?

开发者 https://www.devze.com 2023-02-19 05:05 出处:网络
foo = new Image() foo.x = 500 foo.x => 0开发者_开发问答 var image = new Image(); image.foo = 100;
foo = new Image()
foo.x = 500
foo.x => 0开发者_开发问答


var image = new Image();
image.foo = 100;
alert(image.foo); 

works perfectly, you can't change x because it's predefined and has only a getter Method

0

精彩评论

暂无评论...
验证码 换一张
取 消