简体   繁体   中英

How load a image with Javascript

I'm developing a App in android by Appinventor. So I need call a html page in order to run a javascript that load a image. The question is: how load a image file (with static path and filename) on html page? I've found tutorials that well explain this but only for files selected manually by user.

Thanks in advanced

$( ".inner" ).append( '<img src="xxx" />' );

参考: http : //api.jquery.com/append/

With this code you append a new image, that has the source "my_image.jpg" to an element called container (that is id)

var img = document.createElement('img');
img.src = 'my_image.jpg';
document.getElementById('container').appendChild(img);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM