单独使用CKFinder选择图片的方法

(编辑:jimmy 日期: 2024/10/11 浏览:2)

复制代码 代码如下:
<div>
<script type="text/javascript" src="/UploadFiles/2021-04-02/ckfinder.js"><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