Trade_list.aspx
   <script language="javascript">  
             function  aa(i)  
                {  
                  document.getElementById("myFile").value=i;      
                }  
</script>
   <INPUT id="myFile" type="file" name="myFile" runat="server">
      <asp:button id="Button1" runat="server" Text="上传"></asp:button>
Trade_list.aspx.cs
     file file1 = new file();
string ispic=file1.upfile(myFile,"../../upfile/product/");//参数2为地址,空串表示当前文件夹
string FullPath="../../upfile/product/"+ispic;
Button1.Attributes.Add("onclick","aa("+FullPath+");");
  为什么前台myFile不能得到后台FullPath的值,我该怎么写???

解决方案 »

  1.   

    1、应该这样写Button1.Attributes.Add("onclick","aa('"+FullPath+"');");
    2、文件框不能用脚本赋值,只能由用户选择文件
      

  2.   

    superliu1122(新人报到) ( ) 信誉:100 
    -------------------------------------------------------
    应该这样写Button1.Attributes.Add("onclick","aa('"+FullPath+"');");
    ------------------------------
    我这样写过,也没有用,
    ----------------------
    文件框不能用脚本赋值,只能由用户选择文件?????????/