我需要将我正在完美获取的图像源放入 <img/>
地方,但我不知道如何。
js:
var aa = document.getElementById("TableImage"+getid).src;
alert(aa);
Result of above js:
现在我想将此链接放在这里:
<!-- Upload Part -->
<div class="ImageUpload">
<label for="FileInput" style="width: 18px; height: 18px; margin-top: -160px; margin-left: 905px;">
<img class="UplaodPic" src="../../img/Upload_Panel.png"/>
</label>
<input name="picture" id="FileInput" type="file" onchange="readURL(this,'Picture2')" style="cursor: pointer; display: none"/>
</div>
我想替换Upload_Panel.png
图像与源中的图像aa
。帮助会很好。
最佳答案
怎么样:
$("#FileInput").prev("label").find("img").attr("src", aa);
(因为这是唯一具有 ID 的元素,所以我选择了它。不知道您的页面上有多少个此类)
关于javascript - 将 src 值从 javascript 放置到 img 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22672501/