function img_test(){ var img = new Image(); img.src='/path-to-img/'; img.width/=2; document.body.appendChild(img); }