Chr*_*ini 14 javascript jquery file-upload uploadify
是否可以使用uploadify允许任何用户从文件对话框中选择文件并将其插入到表单的文件输入元素中?我只需要使用uploadify作为将"上传按钮"设置为图像的方式.
我还可以使用/做什么来将文件输入元素作为图像?
我希望我的文件输入按钮在所有浏览器中看起来都一致.
Ata*_*hev 40
我不记得该技术的来源,但这个似乎是跨浏览器.测试中:
这是完整的代码:
HTML:
<div>
<button><!-- this is skinnable -->Pick a file ...</button>
<input type="file" />
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
div
{
position:relative;
width: 100px;
height: 30px;
overflow:hidden;
}
div button
{
position: absolute;
width: 100%;
height: 100%;
}
div input
{
font: 500px monospace; /* make the input's button HUGE */
opacity:0; /* this will make it transparent */
filter: alpha(opacity=0); /* transparency for Internet Explorer */
position: absolute; /* making it absolute with z-index:1 will place it on top of the button */
z-index: 1;
top:0;
right:0;
padding:0;
margin: 0;
}
Run Code Online (Sandbox Code Playgroud)
我们的想法是使<input type="file" />透明化并将其放在一些可以样式化的内容之上(<button>在本例中为a).当最终用户点击按钮时,她实际上会点击<input type="file" />.
| 归档时间: |
|
| 查看次数: |
15448 次 |
| 最近记录: |