<script type="text/javascript">
var user = "";
function check() {
var d = document.forms[0];
if (d.title.value.replace(/(^\s*)|(\s*$)/g, "") == "" && d.textarea.value.replace(/(^\s*)|(\s*$)/g, "") == "") {
alert("标题 或者 内容 至少要填写一项才可以发布噢~");
return false;
}
if (d.textarea.value.length > 8000) {
var num = d.textarea.value.length - 8000;
alert("不能超过4000个字!当前字数为:" + d.textarea.value.length + " 应减去:" + num + "个字");
return false;
}
return true;
}
var jq = jQuery.noConflict();
jq(document).ready(function () {
var cookie_info = ' <%=user_Mes%>';
if (cookie_info != "") {
user = cookie_info.split(',');
blogname.innerHTML = user[1];
img_user(user[0], "2");
}
//退出时,进行session和cookie的清空
jq("#uer_Exit").click(function () {
jq.ajax({
type: "post",
url: '/ashx/Dd_userExit.ashx',
data: { type: "exit", time: new Date().getDate() },
success: function (data) {
if (data == "1") {
window.location.href = "/Dd_login.aspx";
}
},
error: function () {
}
});
});
jq("#pb-submit").click(function () {
if (jq("#pb-main-title-name").html() == "转载文字") {
if (check()) {
jq("#pb-submiting-tip").css("display", "");
jq.ajax({
type: "post",
url: '/ashx/Dd_text.ashx',
data: {
userID: user[0],
originID: "<%=text_originID %>",
ArticleID: "<%=text_ID %>",
CopyFrom: "<%=userid %>",
Order: "0",
state: "reship_text",
title: (jq('#pb-text-title').val()),
content: (jq('#pb-text-textarea').val()),
lable: (jq('#post-tag-input').val()),
check: jq('#pb-top-post').attr("checked"),
time: new Date().getTime()
},
success: function (data) {
if (data == "1") {
window.location.href = "/Default.aspx";
}
},
error: function () {
alert("转载失败!");
}
});
}
}
else {
if (check()) {
jq("#pb-submiting-tip").css("display", "");
jq.ajax({
type: "post",
url: '/ashx/Dd_text.ashx',
data: { userID: user[0],
originID: user[1],
title: (jq('#pb-text-title').val()),
content: (jq('#pb-text-textarea').val()),
lable: (jq('#post-tag-input').val()),
check: jq('#pb-top-post').attr("checked"),
state: "text",
time: new Date().getTime()
},
success: function (data) {
if (data == "1") {
window.location.href = "/Default.aspx";
}
},
error: function () {
alert("发布失败!");
}
});
}
}
});
jq("#pb-cancel").click(function () {
var re = confirm('确定要取消吗?');
if (re == true) {
window.location.href = "/Default.aspx";
}
else
{ }
})
jq("#pb-preview").click(function () {
if (check()) {
jq.ajax({
type: "post",
url: "/Web/Dd_preview.aspx",
data: { title: (jq('#pb-text-title').val()),
content: (jq('#pb-text-textarea').val()),
lable: (jq('#post-tag-input').val()),
type: "0", user: "文章预览",
time: new Date().getTime()
},
success: function () {
window.open("Dd_preview.aspx");
},
error: function () {
}
});
}
});
});
function lable_check() {
jq("#post-tag-list").css("display","none");
jq("#post-tag-input").focus();
}
jq(document).ready(function () {
if ('<%=text %>' == '发布文字') {
jq("#pb-main-title-name").css("display", "block");
}
else if ('<%=text %>' == '编辑文字') {
jq("#pb-main-title").css("display", "block");
jq(".pb-section-title").css("margin-top", "70px");
//jq("#content").css("height", "730px");
}
else if ('<%=text %>' == '转载文字') {
jq("#pb-main-title").css("display", "block");
jq(".pb-section-title").css("margin-top", "70px");
//jq("#content").css("height", "730px");
}
});
</script>
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。