file 控件 如何得到是否选择了文件,怎样清空

file 控件
1。在脚本中怎样才能将文件路径框清空
2。点击选择后会弹出文件选择窗口,怎样才能知道用户按了[打开]还是[取消]

---------------------------------------------------------------

1.(1)

1<form name="form1">
2<input/>
3<input name="f" type="file"/>
4<input onclick="f.select();document.execCommand('delete')" type="button" value="reset"/>
5</form>

(2)

1<form name="form1">
2<input name="f" type="file"/><input onclick="form1.f.outerHTML='&lt;input type=\'file\' name=\'f\'&gt;'" type="button" value="reset"/>
3</form>
Published At
Categories with Web编程
comments powered by Disqus