日期:2014-05-16  浏览次数:20299 次

怎么解决文件选择框只能选择文件不能自己输入文件地址?
就是 <input     type   =   file   onkeypress= "return   false ">
我加了一个onkeypress= "return   false "。这样用户就不能从键盘输入文字了,但是用户可以把文字粘贴进来,或者选择完文件以后用backspace删除一些文字,怎么禁止这些操作呢???

------解决方案--------------------
<script>
function doClick(obj){
obj.readOnly=false;
setTimeout( 'document.getElementById( "aaa ").readOnly = true ',1);
}
</script>


<input type = file id=aaa readonly onclick= "doClick(this) ">