最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
给fckeditor文本编辑器增加图片删除功能
时间:2011-09-27 编辑:简简单单 来源:一聚教程网
在fckeditoreditorfilemanagerbrowserdefault文件夹中找到frmresourceslist.html文件,修改代码如下
oListManager.GetFileRowHtml找到这里,下面代码替换原来的代码
代码如下 | 复制代码 |
oListManager.GetFileRowHtml = function(fileName, fileUrl, fileSize) { // Build the link to view the folder. var sLink = '选择'; // Get the file icon. var sIcon = oIcons.GetIcon(fileName); return '' ; } |
在加个
ajaxdel.js文件
代码如下 | 复制代码 |
//******************************** 图片删除功能 ****************************************** var req; //定义变量,用来创建xmlhttprequest对象 //产生不重复的随机数 var rn = Math.ceil(Math.random() * 1000000); var rnch = rn; function rndnum() { while (rn == rnch) rn = Math.ceil(Math.random() * 1000000); rnch = rn; return rn; } // 删除文件,Ajax开始 function deleteFile(file) { var url = "/ajaxpic.php?filePath=" + escape(file) + "&UD=" + rndnum(); //要请求的服务端地址 if (window.XMLHttpRequest) //非IE浏览器及IE7(7.0及以上版本),用xmlhttprequest对象创建 { req = new XMLHttpRequest(); } else if (window.ActiveXObject) //IE(6.0及以下版本)浏览器用activexobject对象创建,如果用户浏览器禁用了ActiveX,可能会失败. { req = new ActiveXObject("Microsoft.XMLHttp"); } if (req) //成功创建xmlhttprequest { req.open("GET", url, true); //与服务端建立连接(请求方式post或get,地址,true表示异步) req.onreadystatechange = callback; //指定回调函数 req.send(null); //发送请求 } } function callback() { if(req.responseText ==1 ) { alert('删除成功!'); Refresh(); } else { alert('删除失败!'); }//刷新一下 } |
ajaxpic.php文件 保存成ajaxpic.php
代码如下 | 复制代码 |
|
相关文章
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31
- html area标签解读 10-31
- html使用表单标签实现注册页面代码展示 10-31
- 使用HTML截图并保存为本地图片的代码展示 10-31