【发布时间】:2018-04-01 20:38:41
【问题描述】:
我已经从 firebase 数据库中检索了图像 URL,但是当我尝试显示在网页上检索到的图像时,图像的大小没有根据我在正文中的标签中提供的规范进行调整。获得的图像覆盖了整个网页背景。
JS
var myParam=location.search.split('itemKey=')[1];
alert(myParam);
firebase.database().ref('/Sell_Products/'+myParam).once('value').then(function(snapshot)
{var name=snapshot.child('name').val();
alert(name);
var image=snapshot.child('image').val();
var category=snapshot.child('category').val();
var description=snapshot.child('description').val();
var price=snapshot.child('price').val();
document.querySelector('img').src = image;
});
HTML
<img height="125" width="125"/>
【问题讨论】:
-
图片的 html 是什么?
-
html for image is 我已经在stackoverflow上检查了其他答案并尝试了相同的方法,但对我来说没有成功。