socialforge/public/javascripts/project.js

130 lines
3.4 KiB
JavaScript
Raw Normal View History

//验证搜索时输入字
function regexName() {
var name = $.trim($("#name").val());
if (name.length == 0) {
$("#project_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#project_name_span").css('color', '#ff0000');
$("#project_name_span").focus();
return false;
}
else {
$("#project_name_span").text("");
return true;
}
}
// 项目描述超过展开
$(function(){
$(".subNav").click(function(){
$(this).toggleClass("currentDd").siblings(".subNav").removeClass("currentDd")
$(this).toggleClass("currentDt").siblings(".subNav").removeClass("currentDt")
// 修改数字控制速度, slideUp(500)控制卷起速度
$(this).next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
})
})
// 描述显示更多信息
function show_more_msg()
{$("#course_description").toggleClass("course_description_none");}
///////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////项目讨论区
function regexSubject()
{
var content = $.trim($("#message_subject").val());
if(content.length ==0)
{
$("#subject_span").text("主题不能为空");
$("#subject_span").css('color','#ff0000');
return false;
}
else
{
$("#subject_span").text("填写正确");
$("#subject_span").css('color','#008000');
return true;
}
return false;
}
function regexContent()
{
var content = $.trim($("#message_content").val());
if(content.length ==0)
{
$("#message_content_span").text("描述不能为空");
$("#message_content_span").css('color','#ff0000');
return false;
}
else
{
$("#message_content_span").text("填写正确");
$("#message_content_span").css('color','#008000');
return true;
}
return false;
}
// 项目编辑和提交
function submitProjectsBoard()
{
if(regexSubject()&&regexContent()){$("#message-form").submit();}
}
// 提交新闻
function regexTitle()
{
var name = $("#news_title").val();
if(name.length ==0)
{
$("#title_notice_span").text("标题不能为空");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
else if(name.length <= 60)
{
$("#title_notice_span").text("填写正确");
$("#title_notice_span").css('color','#008000');
return true;
}
else
{
$("#title_notice_span").text("标题超过60个字符");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
}
function regexDescription()
{
var name = $("#news_description").val();
if(name.length ==0)
{
$("#description_notice_span").text("描述不能为空");
$("#description_notice_span").css('color','#ff0000');
$("#description_notice_span").focus();
return false;
}
else
{
$("#description_notice_span").text("填写正确");
$("#description_notice_span").css('color','#008000');
return true;
}
}
function submitNews()
{
if(regexTitle() && regexDescription())
{
$("#news-form").submit();
}
}
function submitFocus(obj)
{
$(obj).focus();
}