您的位置:首页 > 编程语言 > ASP

asp.net中使用ckfinder2选择图片并返回图片文件的路径的代码

2011-08-22 11:07 465 查看
在ASP.NET页面中加入以下代码:

<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" Height="17px" Width="429px"></asp:TextBox>
<input type="button" value=" 浏 览 " onclick="BrowseServer('<%=txtImgPath.ClientID %>');" />
</p>
</div>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐