我一直在努力嘗試,但沒有獲勝。HTML/jQuery幫我用這段代碼?
我有一個按鈕和一個div。當用戶點擊該按鈕時,文件瀏覽器打開並允許用戶選擇圖像。圖像被添加到div。這是前面的圖像。
我已經得到了代碼。但我也想複製控件,以便用戶可以添加圖像。但這似乎並不奏效。幫我修復代碼
OR
如果你們能提出一些更好的選擇,那麼這將是驚人的。
這裏的jsbin演示:
HTML :::
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<fieldset>
<legend>Choose Front Image</legend>
<input type=file id='file' class="button" onchange="startRead()"/>
<div id="dragherefront" >Drop files here</div>
<div id="manualfront"></div>
</fieldset>
<fieldset>
<legend>Choose Back Image</legend>
<input type=file id='file' class="button" onchange="startRead()"/>
<div id="draghereback" >Drop files here</div>
<div id="manualback"></div>
</fieldset>
</body>
</html>
CSS ::
#dragherefront{
width: 128px;
height: 128px;
background-color: rgba(221,214,155,0.4);
border: 1px dashed black;
text-align: center;
position: absolute;
opacity: 0;
overflow: hidden;
}
#draghereback{
width: 28px;
height: 128px;
background-color: rgba(221,214,155,0.4);
border: 1px dashed black;
text-align: center;
position: absolute;
opacity: 0;
overflow: hidden;
}
#manualfront{
width: 128px;
height: 128px;
overflow: hidden
background-color: rgba(221,214,221,0.3);
border: 1px dashed black;
overflow: hidden;
z-index: 0;
}
#manualback{
width: 128px;
height: 128px;
overflow: hidden
background-color: rgba(221,214,221,0.3);
border: 1px dashed black;
overflow: hidden;
z-index: 0;
}
請將您的問題縮小到您的代碼的特定區域,並在您的問題中提供該代碼 – charlietfl
「幫我修復代碼」**否**至少直到您有意識地嘗試自行修復它,在你的問題中包含了相關的代碼,並且在代碼應該做什麼的時候增加了很多_far_更多的細節 – Bojangles
我已經提供了jsbin演示,但無論如何我都給出了代碼。 – user3716080