h886

discuz 后台是一个神奇的后台,表单不是用模版写的,而且是用一堆的showsetting(),showsubmit()输出的...
    前几天安装了一个积分兑换的插件.在添加兑换商品的地方碰到了小问题.商品说明,默认的textarea只能用html代码.没有可见可得的在线编辑 器..同事说肯定是要有这个功能的.没有方法,赶紧GOOLE,BAIDU...搜一下午一直没有解决,看到所有输出表单都是
showsetting()函数就搜了一下这个函数的用法.折腾一上午总算有效果了,下午测试修改内容的时候又碰到了问题,幸好全部搞定...
1,
showtablerow()创建textarea及调用在线编译器
showtablerow(\'\', array(\'class="td25"\', \'class="td28"\'), array(
    \' <textarea class="userData" name="content" id="uchome-ttHtmlEditor" style="height: 100%; width: 100%; display: none; border: 0px">\'.stripslashes($showdata[\'detail\']).\'</textarea>\'
));
showtablerow(\'\', array(\'class="td25"\', \'class="td28"\'), array(
    " <iframe src=\'home.php?mod=editor&charset={CHARSET}&allowhtml=1&isportal=0\' name=\'uchome-ifrHtmlEditor\' id=\'uchome-ifrHtmlEditor\'  scrolling=\'no\' style=\'width:700px;height:400px;border:1px solid #C5C5C5;position:relative;\' border=0 frameborder=0 ></iframe>",
));

2.在提前按钮里,加上onclick事件保存编译器内容.
showtablerow(\'\', array(\'class="td25"\', \'class="td28"\'), array(
    "<input id=\'submit_editsubmit\' class=\'btn\' type=\'submit\' value=\'提交\'  name=\'editsubmit\' onClick=\'validate(this);\'>"
));
3.编写onclick事件的JS代码(-这一段是百度得来的)
    <script>
function validate(obj) {
               edit_save();
            window.onbeforeunload = null;
            obj.form.submit();
            return false;
        }
</script>
EOT;

4.调用editor_function.js
  <script type="text/javascript" language="javascript" src="static/image/editor/editor_function.js?{VERHASH}"></script>
 
转自:http://www.cnblogs.com/blankjane/articles/2453119.html

分类:

技术点:

相关文章:

  • 2021-11-13
  • 2021-11-13
  • 2021-08-15
  • 2021-05-27
  • 2021-11-04
  • 2022-01-01
  • 2022-12-23
猜你喜欢
  • 2021-08-06
  • 2022-02-20
  • 2021-11-23
  • 2021-11-02
  • 2022-01-25
相关资源
相似解决方案