ITeye博客

为空判断

kenrome · 2010-08-30 14:54 · Ruby or Rails · Web前端 · Markdown

服务器端的为空判断:ruby

class String
	def blank?
		self.nil? || self.strip.empty?
	end
end

网页前端的为空判断:js


function Check()
	{
		sel = document.yform.manual_action_title_select.value.replace(/\s/gi,"");
		input = document.yform.manual_action_title_input.value.replace(/\s/gi,"");
		if( sel == "" && input == "" ) {alert("value required!");return false;}
		
		return true;
	}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。