<div>
<script type="text/javascript" src="../ckfinder/ckfinder.js"></script>
<script type="text/javascript">
function browseServer(inputId)
{
var finder = new CKFinder() ;
finder.popup() ;
}
//文件选中时执行
function SetFileField(fileUrl,data)
{
document.getElementById(data["selectActionData"]).value = fileUrl ;
}
</script>
<p>
<input type="button" value=" 浏 览 " onclick="browseServer('选择图片后显示路径的文本框id');" />
</p>
</div>
<script type="text/javascript" src="../ckfinder/ckfinder.js"></script>
<script type="text/javascript">
function browseServer(inputId)
{
var finder = new CKFinder() ;
{
finder.selectActionFunction = SetFileField; //设置文件被选中时的函数
finder.selectActionData = inputId; //接收地址的input IDfinder.popup() ;
}
//文件选中时执行
function SetFileField(fileUrl,data)
{
document.getElementById(data["selectActionData"]).value = fileUrl ;
}
</script>
<p>
<input type="button" value=" 浏 览 " onclick="browseServer('选择图片后显示路径的文本框id');" />
</p>
</div>
本文介绍了一种使用CKFinder JavaScript库轻松实现图片上传的方法,包括如何创建按钮、调用CKFinder窗口以及处理返回的文件路径。
1561

被折叠的 条评论
为什么被折叠?



