ckeditor安装及使用

本文介绍 CKEditor 4.7.3 的使用案例,展示如何将普通文本区域转换为富文本编辑器,并通过 JavaScript 实现内容保存功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://ckeditor.com/



当前最新版本

http://download.cksource.com/CKEditor/CKEditor/CKEditor%204.7.3/ckeditor_4.7.3_full.zip



<!DOCTYPE html>
<!--
Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
	<meta charset="utf-8">
	<title>CKEditor Sample</title>
	<script src="../ckeditor.js"></script>
	
	<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script>
	
</head>
<body id="main">
<textarea cols="80" id="Text" name="Text" rows="20">这里是默认值,修改文本的内容是放在这里。html需要进行HTMLEncode编码</textarea>   
<button onclick="OnSave()"> 保存 </button>
 <script type="text/javascript">   
 var editor = CKEDITOR.replace('Text');   
   
function OnSave(){  
        if(CKEDITOR.instances.Text.getData()==""){  
        alert("内容不能为空!");  
        return false;  
        }else {  
        alert (CKEDITOR.instances.Text.getData());  
        }  
    }  
 </script>  

</body>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值