Jquery - 文件输入上的光标指针,可能吗?
如何将 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 /
提前致谢!
彼得
how can i set the cursor:pointer;
to an input file field?
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>
working -> http://jsfiddle.net/tPvJJ/
Thanks in advance!
Peter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在我测试的每个浏览器(Chrome、FF 和 IE)中都没有,即使包装在具有光标属性的父元素中也是如此。可能是出于安全原因,用自定义光标或空光标或其他什么来预防恶作剧。
您可以在上面放置一个透明的 DIV 并为其指定光标属性,但当然,输入字段将不再可单击。
In every browser I tested (Chrome, FF and IE) no, not even when wrapped in a parent element that has the cursor property. Probably for security reasons, to preempt shenanigans with custom cursors or empty cursors or whatever.
You could put a transparent DIV on it and give that the cursor property, but then the input field won't be clickable any more, of course.
我认为你想做的事是不可能的。
不过,这是一个可行的解决方法: http://jsfiddle.net/tPvJJ/10/
仅在Safari,但我不明白为什么它不能在任何其他浏览器中工作。
HTML
JS
I think what you are trying to do is impossible.
Here is a working workaround though: http://jsfiddle.net/tPvJJ/10/
Only tested in Safari but I don't see any reasons why it shouldn't work in any other browser too.
HTML
JS
好吧,这是不可能的:(
创建可点击浏览器按钮的唯一方法是......“flash”。
例如maple -> http://imageshack.us/
Ok, it is not possible :(
The only way to create a clickable browser button is .... "flash".
For exmaple -> http://imageshack.us/
适用于 FF、Chrome 和 IE 7,8,9
HTML
jquery
Works in FF, Chrome and IE 7,8,9
HTML
jquery
您可以尝试代替输入类型“文件”的任何包装器。
检查这个...
http://jsfiddle.net/pFK74/
You can try instead of any wrapper for input type "file".
Check this ...
http://jsfiddle.net/pFK74/