初探百度Ueditor

        Ueditor是由百度web前端研发部开发的所见即所得富文本web编辑器,具有轻量,可定制,注重用户体验等特点,开源基于BSD协议,允许自由使用和使用代码。

        Ueditor官方网址:http://ueditor.baidu.com

        Ueditor的使用参考步骤:

(1)     复制Ueditor相关东东至项目中

        在这里我们在项目的js目录下新建ueditor目录,然后在ueditor官方包中copy相应文件至此目录下,最终结果如下:

(2)     页面内容如下

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%String path = request.getContextPath();%>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=8"/>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <title>初探ueditor</title>
    <script type="text/javascript" src="<%=path%>/js/ueditor/editor_config.js"></script>
    <script type="text/javascript" src="<%=path%>/js/ueditor/editor_ui_all.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=path%>/js/ueditor/ueditor.css"/>
    <style type="text/css">
        #editor {width: 843px;}
        /* for IE6 fixed */
        body {background: url('about:blank') fixed;}
    </style>
</head>
<body>
<script type="text/javascript">
    var editor = new baidu.editor.ui.Editor({
                id: 'editor',
                initialContent: '欢迎使用<a href="
http://ueditor.baidu.com/">UEditor</a>!',
                initialStyle :'.selectTdClass{background-color:#3399FF !important}',
                minFrameHeight: 120
            });
            editor.render('editor');
    function v(){
        document.getElementById('dd').value=document.getElementsByName('editor')[0].innerHTML;
        alert(editor.getContent());
    }
</script>
<input type="button" value="cccc" οnclick="v();"/><br/>
</body>
</html>

(3)     运行结果如下

 

后记:

1. ueditor获取值的方法是:editor.getContent() ;

2. ueditor刚推出的一个东东,还不是太成熟,期待下一版本有更大惊喜。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值