如何用JS控制文件域的值?

来源:百度知道 编辑:UC知道 时间:2024/06/19 11:13:06
比如
<input type=file name=a>
<script>
a.value="bbb";
alert(a.value);
</script>
a的值无变化

<script language="javascript" type="text/javascript">
<!--
function count(){
alert(document.form1.a.value);
}

--></script>
<form name="form1" id="f1" method="post" action="">
<input name="sum" onClick="count()" value="给我看" type="button">
<input type=file id="a" >
</form>

请点击“浏览”后,或者在文件域输入框内输入后才能显示输入框内内容