<input type="file" name="xls_filename" onkeydown="return false;">
解决方案 »
- 怎么替换数组中的数组
- 如果通过checks提交input的值
- JQuery slideUp在IE6会闪一下
- 请问怎样实现 <a href="?st=document.all.v.value" onclick="alert('hi');">sss</a>
- 函数调用出错,不知为什么,请指教
- javascript如何比较中文字符串?
- 高手请问
- 一个很菜的关于Javascript的问题.
- 如何在子窗口中关闭父窗口呀(代码?),谢谢
- jsp中报Uncaught ReferenceError: $ is not defined。
- 如何判断浏览器是否支持javascrip?
- ASP如何获得JavaScript变量,该变量是从<input>得到
function doClick(obj){
obj.readOnly=false;
setTimeout('document.getElementById("aaa").readOnly = true',1);
}
</script>
<input type = file id=aaa readonly onclick="doClick(this)">
onfocus ="this.blur()" 不能获得焦点
这两个配合着用就行了
还是用
onkeydown = "return false"
或者
onkeyup = "return false"
<script>
function doClick(obj){
obj.readOnly=false;
setTimeout('document.getElementById("aaa").readOnly = true',1);
}function ButClick(){
// if(document.form1.txtFakeText.value==""){ //if(document.getElementById("xls_filename").value==""){
// alert("请选择excel文件!");
//}else{
document.form1.action = "dlfxb.jsp";
document.form1.submit();
//}
}</script>
<form name="form1" method="post" action="">
<input type = file id=aaa readonly onclick="doClick(this)">
<input type="button" name="Mits" onclick="ButClick()" value="导入" class=go-wenbenkuang>
</form>
提交不了,总是空,js也报错,不知道为什么
<html>
<head>
<title>File Upload Example</title>
<script language="JavaScript" type="text/javascript">
function ButClick(){
//document.form1.action = "dlfxb.jsp";
document.form1.submit(); }
function HandleFileButtonClick()
{
document.frmUpload.myFile.click();
document.frmUpload.txtFakeText.value = document.frmUpload.myFile.value;
}
</script>
</head>
<body>
<form name="frmUpload">
<input type="file" name="xls_filename" style="display: ">
<input type="text" name="txtFakeText" readonly="true" class=go-wenbenkuang >
<input type="button" onclick="HandleFileButtonClick();" value="浏览Excel文件" class=go-wenbenkuang>
<input type="button" name="Mits" onclick="ButClick()" value="导入" class=go-wenbenkuang> </form>
</body>
</html>
<input type="text" name="fn" id="fn" style="position:absolute;top:0px;left:0px;z-index:2;" readonly>
<input type="file" name="xls_filename" style="position:absolute;top:0px;left:0px;z-index:1;" onchange="document.getElementById('fn').value=this.value;">