我似乎無法從桌面上獲取我的圖像,並將其放入我的一個div標籤中。有人可以幫幫我嗎。如何從桌面讀取圖像並輸入到div標籤中?
<!DOCTYPE html>
<html>
<body>
<img src="C:\Users\aldiaz\Desktop\DynamicsTest1.jpg">
<div id="container" style="width:500px">
<div id="header" style="background-color:#0000F8;">
<h1 style="margin-bottom:0;"> Triton Subs</h1>
</div>
<div id="image" style="background-color:yellow; height:200px;width:100px;float:left;">
<img src="C:\Users\aldiaz\Desktop\DynamicsTest1.jpg height:200px; width:100px;floatleft;">
</div>
<div id="content" style="background- color:#D7D7D7;height:200px;width:400px;float:left;">Dear [FIRSTNAME] [LASTNAME],<br/> <br/>You have earned 5 videos and are ready to redeem.<br/><br/>Log into the Triton Submarines Experience now to choose your reward!
</div>
<div id="footer" style="background-color:#0000F8;clear:both;text-align:center;"> Trinto Sub Co
</div>
</div>
</body>
</html>
使用相對路徑。另外注意第二個img標籤的src。如果上傳到服務器上,您的代碼將無法使用。所以最好在根目錄下創建一個文件夾'images'並使用相對路徑。 – Dev
可能您的Web服務器沒有對用戶桌面文件夾的讀取訪問權限...... – jtheman
@Yusuf - 在回答問題後,您不應該刪除問題。其他人也可能從看到問題及其答案中受益。 –