更新时间:2021-11-20 20:05:17
试试 value
属性,像这样:
Try the value
property, like this:
var fu1 = document.getElementById("FileUpload1");
alert("You selected " + fu1.value);
注意:看起来 FileUpload1
是一个 ASP.Net 服务器端 FileUpload 控件.
如果是这样,您应该使用 ClientID 属性,像这样:
NOTE: It looks like FileUpload1
is an ASP.Net server-side FileUpload control.
If so, you should get its ID using the ClientID
property, like this:
var fu1 = document.getElementById("<%= FileUpload1.ClientID %>");