为什么JS清除不了FILE文本框内容??急死我啦 考虑 defaultValue form1.file1[1].defaultValue=""; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head><title> 3</title><script>function clear1(){var obj = document.getElementById('file1'); obj.outerHTML = obj.outerHTML;}</script></head><body><form ><input type="file" name="file1" size="35" value="12341"/><br><input type="button" value="clear" onclick="clear1()"></form></body></html> FF下不兼容你的JS代码。opera IE Safari 都可以不过先谢谢了。 问题得以解决感谢 s_liangchao1s 的思路加偶的小想法兼容了FF opera IE Safari 都可以清除FILE 文件框的值下面是源码。 <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题 3</title></head><body><form name="form1" id="form1"><input type="file" name="file1" size="35" value="12341"/><br><input type="file" name="file1" size="35" value="12341"/><br><input type="file" name="file1" size="35" value="12341"/><br><input name="btn" onclick="clear1()" type="button" value="点击我"/></form><script language="javascript" type="text/javascript">function clear1(){var obj = document.getElementById('form1').file1[1]; obj.outerHTML = obj.outerHTML; document.getElementById('form1').file1[1].value="";}</script></body></html> 百思不得其解,哪位人兄可以告诉我原因是什么吗?关键就是加了obj.outerHTML = obj.outerHTML;这句话. 如何写JS来改变FCKeditor编辑器输入框中的内容呢?在线等,急用。。 求助 输入的只能是 英文 汉字 数字 !求教 AJAX 有时会出现不连接的情况 asp.net跟sql2005连接问题?---用户 'sa' 登录失败。 请教:做一个防止刷新的计数器 doucment.all的问题来了 ie6.0 text的dbclick()中显示模式窗体,后者不出现. 想问几个event问题 简单问题,扑捉右键事件,如何屏蔽右键 如何用js绘制数学函数? 关于取得父对象中的子对象的问题 ! rollover={init:... end:...} 是函数的特殊写法吗?
<html><head>
<title> 3</title>
<script>
function clear1(){
var obj = document.getElementById('file1');
obj.outerHTML = obj.outerHTML;
}
</script>
</head><body>
<form ><input type="file" name="file1" size="35" value="12341"/><br><input type="button" value="clear" onclick="clear1()">
</form>
</body></html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题 3</title>
</head><body>
<form name="form1" id="form1">
<input type="file" name="file1" size="35" value="12341"/><br>
<input type="file" name="file1" size="35" value="12341"/><br>
<input type="file" name="file1" size="35" value="12341"/><br>
<input name="btn" onclick="clear1()" type="button" value="点击我"/>
</form>
<script language="javascript" type="text/javascript">
function clear1()
{
var obj = document.getElementById('form1').file1[1];
obj.outerHTML = obj.outerHTML;
document.getElementById('form1').file1[1].value="";}
</script>
</body></html>
关键就是加了obj.outerHTML = obj.outerHTML;这句话.