如何在javascript中获取asp文件上传的价值

时间:2013-11-15 07:15:03

标签: javascript asp.net

如何在javascript中获取asp fileupload的值。我试过但是无法获得两个文件上传的价值。

function alertupload() {>  
             var firstvalue = document.getElementById("ctl01_uxPlaceHolder_uxProductFormView_ctl01_uxOptionGroupDetails_uxOptionDataList_ctl00_uxOptionItemDetails_uxOptionUploadItem_uxUploadFile").value;

             var backvalue = document.getElementById("ctl01_uxPlaceHolder_uxProductFormView_ctl01_uxOptionGroupDetails_uxOptionDataList_ctl01_uxOptionItemDetails_uxOptionUploadItem_uxUploadFile").value;

            alert(frontvalue);
            alert(backvalue);              

 }

1 个答案:

答案 0 :(得分:0)

如果ctl01_uxPlaceHolder_uxProductFormView_ctl01_uxOptionGroupDetails_uxOptionDataLi‌​st_ctl00_uxOptionItemDetails_uxOptionUploadItem_uxUploadFile为id,那么它应该有效。

其他明智的使用客户端ID

var firstvalue = document.getElementById("<%= uxUploadFile.ClientID %>");
alert(firstvalue);