Jquery-文件输入上的光标指针,可能吗?
Jquery-文件输入上的光标指针,可能吗?,jquery,html,css,input,cursor,Jquery,Html,Css,Input,Cursor,如何设置光标:指针到输入文件字段 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; te
如何设置
光标:指针代码>到输入文件字段
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>
工作->
提前谢谢
Peter在我测试的每个浏览器(Chrome、FF和IE)中都没有,即使包装在具有cursor属性的父元素中也没有。可能是出于安全原因,用自定义游标或空游标或其他任何东西来阻止恶作剧
当然,您可以将光标属性放入并赋予该属性,但输入字段将不再可单击。在我测试的每个浏览器(Chrome、FF和IE)中都不可以,即使包装在具有光标属性的父元素中也不行。可能是出于安全原因,用自定义游标或空游标或其他任何东西来阻止恶作剧
当然,您可以将光标属性放入并赋予该属性,但输入字段将不再可单击。我认为您试图做的是不可能的
但这里有一个可行的解决方法:
仅在Safari中进行了测试,但我看不出为什么它不能在任何其他浏览器中工作
HTML
我认为你想做的是不可能的
但这里有一个可行的解决方法:
仅在Safari中进行了测试,但我看不出为什么它不能在任何其他浏览器中工作
HTML
好的,这是不可能的:(
创建可单击浏览器按钮的唯一方法是…“flash”
对于exmaple->Ok,不可能:(
创建可单击浏览器按钮的唯一方法是…“flash”
对于exmaple->在FF、Chrome和IE 7,8,9中工作
HTML
在FF、Chrome和IE 7,8,9中工作
HTML
您可以尝试替换输入类型“file”的任何包装器
选择一个文件
检查这个。。。
您可以尝试替换输入类型“file”的任何包装器
选择一个文件
检查这个。。。
您好,这在FF上不起作用。FF不喜欢输入文件的触发器:(不允许在所有浏览器上使用,在某些浏览器上触发文件字段上的单击事件被视为安全问题。您好,这在FF上不起作用。FF不喜欢输入文件的触发器:(在所有浏览器上都不允许,在某些浏览器上触发文件字段上的单击事件被视为安全问题。在此之后,无法通过IE上的javascript提交表单,因为调用$(“#file_input”)。单击()会使表单不安全。在此之后,无法通过IE上的javascript提交表单,因为调用$(“#file_input”).click()使表单不安全。
<form id="up_1" name="up_1" action="" enctype="multipart/form-data" method="post">
<input id="file_input" type="file" name="file_input" style="opacity: 0.2;">
<div id="ico_hdd" style="cursor: pointer;">
<img src="http://img834.imageshack.us/img834/9831/iconhdd.png">
</div>
</form>
$(function() {
$('#ico_hdd').click(function(e){
$('#file_input').trigger('click');
});
});
<input id="file_input" type="file" name="file_input" style="visibility:hidden;">
<div id="ico_hdd" style="cursor: pointer;"> <img src="http://img834.imageshack.us/img834/9831/iconhdd.png"> Dodaj plik </div>
$('#ico_hdd').on("click", trigbutton);
function trigbutton(){
$('#file_input').trigger('click');
}
<label for="photo"><span class="button">CHOOSE A FILE</span></label>