type=file是没有默认value的
也不能script写入
原因:引用:
--------------------------------------------------------------------------------Q11. I am trying to specify a default value for an <INPUT TYPE=FILE> item on my form, but the browser seems to ignore the VALUE attribute of this tag. Client-side JavaScript does not help either. Is there a way I can programmatically specify a file for uploading?
A. No, and there is a good reason for that. If setting a default value for <INPUT TYPE=FILE> were allowed, one could easily write an HTML page that would steal files from a user's machine without his/her knowledge or permission. Although pure HTML won't help you, there is still a way to specify a file for uploading programmatically: use a client-side upload agent such as the XUpload ActiveX control available from www.aspupload.com. --------------------------------------------------------------------------------
也不能script写入
原因:引用:
--------------------------------------------------------------------------------Q11. I am trying to specify a default value for an <INPUT TYPE=FILE> item on my form, but the browser seems to ignore the VALUE attribute of this tag. Client-side JavaScript does not help either. Is there a way I can programmatically specify a file for uploading?
A. No, and there is a good reason for that. If setting a default value for <INPUT TYPE=FILE> were allowed, one could easily write an HTML page that would steal files from a user's machine without his/her knowledge or permission. Although pure HTML won't help you, there is still a way to specify a file for uploading programmatically: use a client-side upload agent such as the XUpload ActiveX control available from www.aspupload.com. --------------------------------------------------------------------------------
<script language="JavaScript">
function uploadnext()
{
document.getElementById("ufspan").innerHTML = "<input type=\"file\" name=\"uploadfile\"/>";
}
</script>
<head>
<title>NameTitle</title><script language="JavaScript">
function uploadnext()
{
document.getElementById("ufspan").innerHTML = "<input type=\"file\" id=\"ddd\" name=\"uploadfile\"/>";
}
</script></head>
<body>
<span id="ufspan"><input id="ddd" type="file" name="uploadfile"/></span>
<a HREF="#" onclick="uploadnext()" >dd2005-10-18</a>
</body>
</html>