2012-02-08 14 views
1

我在我的asp.net窗體中有一個fileupload控制器。我要在單選按鈕上使用javascript清空fileupload文本。使用Javascript的空FileUpload文本

我們將如何做that.Here是我的代碼...

<asp:RadioButton ID="rbnImage" runat="server" Text="Image" GroupName="a" 
onclick="SetVisibility(this.id)" 

的Javascript放在這裏

function SetVisibility(id) { 
     if (id == 'rbnImage') { 
      document.getElementById('fupLogo').style.visibility = 'visible'; 
      document.getElementById('fupLogo').value = '';     
      document.getElementById('txtText').style.visibility = 'hidden'; 
     } 

    } 

此代碼是不是文本框工作working.Its。

+0

你看到了單選按鈕的id是 'rbnImage' 你問 'rbnText'? – Hadas 2012-02-08 09:26:43

+0

對不起我在提問的過程中發生的錯誤。我改正了它 – ksg 2012-02-08 09:30:44

回答

2

您無法設置文件上傳的值。

試試這招:

var browse=document.getElementById(control); 
var newbrowse= browse.cloneNode(false); 
browse.parentNode.replaceChild(newbrowse ,browse); 
+0

Hurray它的工作正常...非常感謝..你能解釋fileuploader如何變空 – ksg 2012-02-08 09:58:06