如下代码
<script language=javascript>
function changeVal()
{
  document.upForm.te.value = "c:/12.xml";  //此处弹出的对话框是空值
  alert(document.upForm.te.value);
}
</script><body onload="changeVal()">
<form name="upForm" method="post" action="up2.jsp"enctype="multipart/form-data" >
<input type=file name="te">
</form>
</body>我发现Form表单中的te标签(type类型为File)无法赋值,在changeVal函数中赋值了,但alert时,仍然是空值,真的有点晕,如果想赋值,该如何写javascript脚本代码

解决方案 »

  1.   

    value Property
    --------------------------------------------------------------------------------
    Retrieves the file name of the INPUT control object after the text is set by user input.SyntaxHTML N/A 
    Scripting [ sValue = ] INPUT type=file.value Possible ValuessValue String that receives the file name value of an INPUT type=file control object. The property is read-only. The property has no default value.Expressions can be used in place of the preceding value(s), as of Microsoft&reg; Internet Explorer 5. For more information, see Dynamic Properties.Applies To INPUT type=file 已经说明了是只读的了。