[英]Image not being displayed in divison
我的HTML頁面中有一個分區,並且試圖在其中顯示圖像。 我做了這樣的事情:
在Java腳本部分中:
var nameoffile="andrew.png";
$("#detected").show().html('<img src="trainingImages/""'+nameoffile+'" >');
在HTML部分:
<div id="detected"></div>
請幫助我查找代碼問題。 提前致謝!!
您需要正確連接您的值,以及首先設置html
然后顯示內容:
$("#detected").show().html('<img src="trainingImages/'+nameoffile+'" >');
您有語法錯誤。 它應該是:
$("#detected").show().html('<img src="trainingImages/'+nameoffile+'" >');
用這個:
var nameoffile="andrew.png";
$("#detected").show().html('<img src="trainingImages/'+nameoffile+'" >');
// remove "" here ^^
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.