靠,kindeditor4编辑器如何提交数据啊?弄不懂了啊!下面是内容,哪里出错了呢?如果是AJAX提交呢?
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="textml; charset=GB2315" />
<title>无标题文档</title>
<style type="text/css">
<!--
*{ margin:0; padding:0;}
body{ background:#FFF; text-align:center; color:#000;}
#container{ margin:0 auto; width:1003px; border:0px solid #000;background:#cccccc}
.header{ margin-bottom:10px; border:1px solid #000; height:80px;}
.left{ width:220px; float:left; height:500px;border:1px solid #000;margin-right:10px; display:inline;}
.right{ float:right;display:inline;}
.right .imag{ width:517px; float:left; height:200px; border:1px solid #000; }
.right .other{ width:242px; float:right; margin-left:10px;}
.right .other .H2{ width:240px; height:95px; border:1px solid #000; margin-bottom:10px;}
.right .content{border:1px solid #000; clear:both; height:385px;}
-->
</style>
</head>
<body>
<script charset="utf-8" src="editor/kindeditor.js"></script>
<script charset="utf-8" src="editor/lang/zh_CN.js"></script>
<script>
var editor;
KindEditor.ready(function(K) {
editor = K.create('#Content',{width:'767px',height:'340px'});
});
function save()
{
var s = KE.util.getData("content_1");
s = KE.util.escape(s);
document.getElementById("content_1_1").value = s;
}
</script>
<div id="container">
<div class="header">标题头</div>
<div class="left">左侧导航栏位</div>
<div class="right">
<div class="content">
<div style=""></div>
<div style="border:1px solid #ccccc"><textarea id="Content" name="Content" cols="100" rows="8" style="width:700px;height:300px;"></textarea></div>
<input type="submit" value="submit" onclick="javascript:save()"/>
</div>
</div>
<br clear="all" />
</div>
<script type="text/javascript"></script>
</body>
<html> 展开
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="textml; charset=GB2315" />
<title>无标题文档</title>
<style type="text/css">
<!--
*{ margin:0; padding:0;}
body{ background:#FFF; text-align:center; color:#000;}
#container{ margin:0 auto; width:1003px; border:0px solid #000;background:#cccccc}
.header{ margin-bottom:10px; border:1px solid #000; height:80px;}
.left{ width:220px; float:left; height:500px;border:1px solid #000;margin-right:10px; display:inline;}
.right{ float:right;display:inline;}
.right .imag{ width:517px; float:left; height:200px; border:1px solid #000; }
.right .other{ width:242px; float:right; margin-left:10px;}
.right .other .H2{ width:240px; height:95px; border:1px solid #000; margin-bottom:10px;}
.right .content{border:1px solid #000; clear:both; height:385px;}
-->
</style>
</head>
<body>
<script charset="utf-8" src="editor/kindeditor.js"></script>
<script charset="utf-8" src="editor/lang/zh_CN.js"></script>
<script>
var editor;
KindEditor.ready(function(K) {
editor = K.create('#Content',{width:'767px',height:'340px'});
});
function save()
{
var s = KE.util.getData("content_1");
s = KE.util.escape(s);
document.getElementById("content_1_1").value = s;
}
</script>
<div id="container">
<div class="header">标题头</div>
<div class="left">左侧导航栏位</div>
<div class="right">
<div class="content">
<div style=""></div>
<div style="border:1px solid #ccccc"><textarea id="Content" name="Content" cols="100" rows="8" style="width:700px;height:300px;"></textarea></div>
<input type="submit" value="submit" onclick="javascript:save()"/>
</div>
</div>
<br clear="all" />
</div>
<script type="text/javascript"></script>
</body>
<html> 展开
1个回答
展开全部
在页面里面必须添加一个textarea标签,并且这个标签的ID就是你创建kindeditor指定的ID是一致的。然后提交的时候就可以通过这个textarea的name进行获取了。
追问
你都没看就说了,我上面的其他功能正常的。
追答
不好意思。没看清你的代码。获取内容的js代码是
// 取得HTML内容
html = editor.html();
// 同步数据后可以直接取得textarea的value
editor.sync();
html = document.getElementById('editor_id').value; // 原生API
html = K('#editor_id').val(); // KindEditor Node API
html = $('#editor_id').val(); // jQuery
// 设置HTML内容
editor.html('HTML内容');
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询