我一直在努力尝试,但没有获胜。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