我需要将我正在完美的图像源放到<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
中的图片。帮助会很好。
答案 0 :(得分:2)
怎么样:
$("#FileInput").prev("label").find("img").attr("src", aa);
(因为这是唯一带有ID的元素,所以我选择了。不知道你的页面上有多少个类)
答案 1 :(得分:1)
var aa = document.getElementById("TableImage"+getid).src;
$('.uplaodPic').attr('src', aa)