代碼如下:
<div>
<script type="text/javascript" src="../ckfinder/ckfinder.js"></script>
<script type="text/javascript">
function BrowseServer(inputId)
{
var finder = new CKFinder() ;
finder.basePath = '../ckfinder/'; //導入CKFinder的路徑
finder.selectActionFunction = SetFileField; //設置文件被選中時的函數
finder.selectActionData = inputId; //接收地址的input ID
finder.popup() ;
}
//文件選中時執行
function SetFileField(fileUrl,data)
{
document.getElementById(data["selectActionData"]).value = fileUrl ;
}
</script>
<p>
<asp:TextBox ID="txtImgPath" runat="server"></asp:TextBox>
<input type="button" value=" 浏 覽 " onclick="BrowseServer('<%=txtImgPath.ID %>');" />
</p>
</div>
注:CKFinder 2.0
下載地址:http://ckfinder.com/download