如何将 cursor:pointer;
设置为输入文件字段?
html
<form id="up_1" name="up_1" action="" enctype="multipart/form-data" method="post">
<div style="position: relative;">
<input id="file_input" type="file" name="file_input" style="position: relative; text-align: right; opacity: 0; z-index: 2;" />
<div id="ico_hdd" style="position: absolute; top: 0px; left: 0px; z-index: 1;">
<img src="http://img834.imageshack.us/img834/9831/iconhdd.png" style="margin-bottom: -4px;"/>
</div>
</div>
</form>
工作 -> http://jsfiddle.net/tPvJJ/
提前致谢!
彼得
最佳答案
在我测试的每个浏览器(Chrome、FF 和 IE)中都不会,即使包装在具有光标属性的父元素中也是如此。可能是出于安全原因,用自定义光标或空光标或其他什么来预防恶作剧。
你可以输入 a transparent DIV on it并赋予 that 光标属性,但是输入字段当然将不再可单击。
关于Jquery - 文件输入上的光标指针,可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4112643/