1)把当前的编辑器form表单提交修改为Javascript方式提交。
<form action="index.php" method="POST" name="myForm">form表单加入name元素。
<button class="btn2">提交</button>
submit提交改为button方式。
<script type="text/javascript">
function submitForm(){
document.myForm.action = document.myForm.action
document.myForm.submit()
}
$(".btn2").click(function(){
submitForm()
})
</script>
2)通过UEditor API中的editor.execCommand( 'source')方法事件,在源代码状态提交时切换为编辑模式。
<script type="text/javascript">var ue = UE.getEditor('editor',{
toolbars: [["undo","redo","|","bold","italic","underline","strikethrough","|","fontsize","forecolor","backcolor","|","removeformat","|","selectall","cleardoc","source","|","unlink","link","|","insertimage"]],wordCount:false
})
function submitForm(){
document.myForm.action = document.myForm.action
document.myForm.submit()
}
$(".btn2").click(function(){
ue.execCommand('source')
submitForm()
})
</script>
不明白可以看着这篇文章http://www.uphtm.com/cms/308.html,很详细
这位网友你好,压缩后文件大小会变小,里面的内容还是照样解析的,不会受影响。压缩代码可以加快加载速度,一般情况下比较大型的网站都是要求压缩的,小网站就没什么必要了,样式不会受影响,请放心使用。当然了,压缩的时候都是需要备份的,以防万一。