得到tinymce富文本编辑中的内容
<script type="text/javascript">
function submitfcn(form){
var myform = form[0];
var title = document.getElementById('id_title').value;
var content = tinyMCE.getInstanceById('id_content').getBody().innerHTML; //得到tinymce富文本编辑中的内容
var exist = content.match(/\{name\}/g)&&content.match(/\{url\}/g);
var done = true;
if(!title){
done = false;
document.getElementById('id_title').focus();
alert('请填写邮件标题!');
}
if(!exist){
done = false;
tinyMCE.getInstanceById('id_content').getBody().focus();
alert('请填写邮件内容!');
}
if(done){
$.ajax({
type: 'POST',
url: "/emailrecord/sendemaildialog/",
data: $(myform).serialize(),
dataType:'json',
success: function(data){
if(data.result==1){
alert('邮件发送成功。');
location.href = '/progress/summary/';
}else if(data.result==0){
alert('统计失败!');
location.href = '/progress/summary/';
}else{
alert('邮件没有发送,因为您没选人员或所选人员已完成了问卷的录入!');
}
},
error:function(re,status){
}
});
}else{
return false;
}
}
</script>
<table cellspacing="0" cellpadding="0" border="0" class="display tdBc first_table" width="100%">
<caption>
<span><strong>邮件发送 {{term}}</strong> </span><a href="/progress/summary/" style="float: right;">返回 </a>
</caption>
<tr><td>
<fieldset class="module aligned ">
<div class="form-row">
<div>
<label for="id_title" class="required">邮件标题:</label><input id="id_title" type="text" name="title" maxlength="128" />
</div>
</div>
<div class="form-row">
<div>
<label for="id_content" class="required">邮件内容:</label>
<textarea id="id_content" rows="10" cols="40" name="content">
<br />
邮件内容模板如下:但是{name}{url},不能更改,一定要存在!该行请删除,谢谢<br /><br />
尊敬的某公司员工 {name}:<br />
请尽快登录360满意度测评系统({url}),请用点击提供的链接的登入系统,进行填写问卷。<br />
如果对网络平台操作存在疑问,请联系马神通,<br /><br />
本邮件为系统邮件,请勿回复!<br />
<label style="margin-left:550px;">人力资源部</label>
</textarea>
<script type="text/javascript">
tinyMCE.init({
language:"zh",
theme : "advanced",
mode : "textareas",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
height: 300, width: 800,
content_css : "/static/tiny_mce/themes/advanced/skins/default/content.css"
});
</script>
</div>
</div>
</fieldset>
<div>
<input type="button" value="确定" onclick="submitfcn($('form'))"/>
</div>