Jquery提交Form 获取FCKeditor的值
(方式一)
$(document).ready(function () {
$("#Submit1").click(function () {
alert('bb');
$("#form1").submitForm(
{
url: "/CMS/saveArticle.aspx",
callback: function (data) {
if (data.result == "1") {
alert("修T改?成¨¦功|!ê?");
location.href = "Article.aspx";
}
else if (data.result == "99") {
alert("修T改?失º¡ì败㨹!ê?");
}
else if (data.result == "2") {
alert("添¬¨ª加¨®成¨¦功|!ê?");
location.href = "Article.aspx";
}
else if (data.result == "99") {
alert("添¬¨ª加¨®失º¡ì败㨹!ê?");
}
},
before: function () {
return true;
}
})
}).submit()
})
(方式二)
function saveMessage() {
//字Á?段?
var Title = $("#Title").val();
var ShortTitle = $("#ShortTitle").val();
var AdClass = $("#DropAdClass").val();
var Source = $("#Source").val();
var KeyWord = $("#KeyWord").val();
var Editor = $("#Editor").val();
var ImgPath =$("#ImgPath").val();
var HtmlPath = $("#HtmlPath").val();
var Remark = $("#Remark").val();
var content = getEditorHTMLContents('Content');
var OrderId = $("#OrderId").val();
var status = $("#Status").val();
//隐°t藏?值¦Ì
var id = $("#hidId").val();
var action = $("#hidAction").val();
$.post("/CMS/saveArticle.aspx", { Title: Title, ShortTitle: ShortTitle, AdClass: AdClass, Source: Source, KeyWord: KeyWord, Editor: Editor, ImgPath: ImgPath,HtmlPath: HtmlPath,Remark:Remark,content:content,OrderId:OrderId,status:status, id: id, action: action }, function (data) {
if (data == "EditSuccess") {
alert("修改成功");
location.href = "Article.aspx";
}
else if (data == "EditFailed") {
alert("修改失败");
location.href = "Article.aspx";
}
else if (data == "AddSuccess") {
alert("添加成功");
location.href = "Article.aspx";
}
else if (data == "AddFailed") {
alert("添加失败");
location.href = "Article.aspx";
}
else {
alert(data);
}
});
return false;
}
//获取FCK的值
function getEditorHTMLContents(EditorName) {
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return oEditor.EditorDocument.body.innerText;
}
$(document).ready(function () {
$("#Submit1").click(function () {
alert('bb');
$("#form1").submitForm(
{
url: "/CMS/saveArticle.aspx",
callback: function (data) {
if (data.result == "1") {
alert("修T改?成¨¦功|!ê?");
location.href = "Article.aspx";
}
else if (data.result == "99") {
alert("修T改?失º¡ì败㨹!ê?");
}
else if (data.result == "2") {
alert("添¬¨ª加¨®成¨¦功|!ê?");
location.href = "Article.aspx";
}
else if (data.result == "99") {
alert("添¬¨ª加¨®失º¡ì败㨹!ê?");
}
},
before: function () {
return true;
}
})
}).submit()
})
(方式二)
function saveMessage() {
//字Á?段?
var Title = $("#Title").val();
var ShortTitle = $("#ShortTitle").val();
var AdClass = $("#DropAdClass").val();
var Source = $("#Source").val();
var KeyWord = $("#KeyWord").val();
var Editor = $("#Editor").val();
var ImgPath =$("#ImgPath").val();
var HtmlPath = $("#HtmlPath").val();
var Remark = $("#Remark").val();
var content = getEditorHTMLContents('Content');
var OrderId = $("#OrderId").val();
var status = $("#Status").val();
//隐°t藏?值¦Ì
var id = $("#hidId").val();
var action = $("#hidAction").val();
$.post("/CMS/saveArticle.aspx", { Title: Title, ShortTitle: ShortTitle, AdClass: AdClass, Source: Source, KeyWord: KeyWord, Editor: Editor, ImgPath: ImgPath,HtmlPath: HtmlPath,Remark:Remark,content:content,OrderId:OrderId,status:status, id: id, action: action }, function (data) {
if (data == "EditSuccess") {
alert("修改成功");
location.href = "Article.aspx";
}
else if (data == "EditFailed") {
alert("修改失败");
location.href = "Article.aspx";
}
else if (data == "AddSuccess") {
alert("添加成功");
location.href = "Article.aspx";
}
else if (data == "AddFailed") {
alert("添加失败");
location.href = "Article.aspx";
}
else {
alert(data);
}
});
return false;
}
//获取FCK的值
function getEditorHTMLContents(EditorName) {
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return oEditor.EditorDocument.body.innerText;
}