affetmekyok
//上传信息代表图片
function upload_picture(inputName)
{
window.open('/lib/editor/upload_picture.php?inputName='+inputName,'we','width=300px,height=100px,top=200px,left=200px');
}
//上传文件
function upload_file(inputName)
{
window.open('/lib/editor/upload_file.php?inputName='+inputName,'we','width=300px,height=100px,top=200px,left=200px');
}
//上传贴图
function upload_image(box)
{
window.open('/lib/editor/upload_image.php?editorIframeName='+box,'we','width=300px,height=100px,top=200px,left=200px');
}
//上传附件
function upload_attach(box)
{
window.open('/lib/editor/upload_attach.php?editorIframeName='+box,'we','width=300px,height=100px,top=200px,left=200px');
}
//插入表格
function insert_table(box)
{
window.open('/lib/editor/insert_table.php?editorIframeName='+box,'we','width=350px,height=150px,top=200px,left=200px');
}
//插入flash动画
function insert_swf(box)
{
window.open('/lib/editor/upload_swf.php?editorIframeName='+box,'we','width=300px,height=100px,top=200px,left=200px');
}
//上传UBB图片
function upload_ubb_image(contentName)
{
window.open('/lib/editor/upload_ubb_image.php?contentName='+contentName,'we','width=350px,height=180px,top=200px,left=200px');
}
//过滤垃圾代码
function clean_content(box)
{
if (window.confirm('将进行word/excel垃圾代码过滤,可能需要几秒钟时间,确认过滤吗?'))
{
var content_dirty = eval("window."+box+".document.body.innerHTML");
content_dirty = content_dirty.replace(/<\/?SPAN[^>]*>/gi, "");
content_dirty = content_dirty.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
content_dirty = content_dirty.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3");
content_dirty = content_dirty.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
content_dirty = content_dirty.replace(/<\\?\?xml[^>]*>/gi, "");
content_dirty = content_dirty.replace(/<\/?\w+:[^>]*>/gi, "");
content_dirty = content_dirty.replace(/ /, " ");
content_dirty = content_dirty.replace(/(
]*>.*?)(<\/P>)/gi,"
");
eval("window."+box+".document.body.innerHTML=content_dirty");
alert("垃圾代码过滤完成");
}
}
//编辑器一系列格式化操作
function leftAlign(box)
{
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('JustifyLeft',true);
}
function centerAlign(box)
{
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('JustifyCenter',true);
}
function rightAlign(box)
{
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('JustifyRight',true);
}
function textB(box)
{
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('Bold',true);
}
function textI(box)
{
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('Italic',true);
}
function textU(box)
{
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('Underline',true);
}
function unFormat(box)
{
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('RemoveFormat',true);
}
function createLink(box)
{
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('CreateLink',true);
}
function fontSize(box)
{
var size1=event.srcElement.value;
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('FontSize',true,size1);
}
function textIn(box)
{
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('Indent',true);
}
function textOut(box)
{
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('Outdent',true);
}
function setColor(box)
{
var color_font=event.srcElement.value;
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('ForeColor',true,color_font);
}
function fontFace(box)
{
var font_face=event.srcElement.value;
var textRange1=eval("window."+box+".document.selection.createRange()");
textRange1.execCommand('FontName',true,font_face);
}
//自动添充有关
var submit_command ="";
function run()
{
if (submit_command!="")
{
eval(submit_command);
}
}