ceshi

Posted jquery37

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ceshi相关的知识,希望对你有一定的参考价值。

/************************************************创建关系,根据发布情况************************************************************/
function createPublishHidden_child(type){
	subOption.parentId = $(‘#chooseProblemRelay‘).val();
	var put = "";
	var str = "";
	var ret = {};
	var number = 0;
	//新增
	if(type){
		$(‘#dialog-problemRelay .child-item‘).each(function(num, value){
			var current = $(‘#parentItemSelect option‘).eq(num);
			var currentValue = current.val();
			//requireinput存在则手动添加#??#
			if(current.attr("requireinput")){
				currentValue = currentValue + "#??#";
			}
			var arr = [];
			$(this).find(‘.citem‘).each(function(num, value){
				var oVal = $.trim($(this).children(‘input[type=text]‘).val());
				var oCid = $(value).children(‘input[type=text]‘).attr(‘cid‘);
				if(oVal != ‘‘){
					str += oVal+"
";
					arr.push(oVal);
				}
				if(oCid){
					put += ‘<input type="hidden" cid="‘+oCid+‘" name="options[‘+number+‘].key" value="‘+oCid+‘">‘;
					put += ‘<input type="hidden" cid="‘+oCid+‘" name="options[‘+number+‘].value" value="‘+oVal+‘">‘;
					number++
				}else{
					if(oVal){
						put += ‘<input type="hidden" name="options[‘+number+‘].key" value="‘+oVal+‘">‘;
						put += ‘<input type="hidden" name="options[‘+number+‘].value" value="‘+oVal+‘">‘;
						number++
					}
				}
			})
			ret[currentValue] = arr;
		})
		//去空值
		if(str.substr(-1) == ‘
‘){
			str = str.substr(0, str.length-1)
		}
		subOption.options = str;
		subOption.jsonOptions = ret;
	//初始化
	}else{
		$(‘#disabledlab input[type=checkbox]‘).each(function(num, value){
			var oCid = $(value).attr(‘cid‘);
			var oVal = $(value).attr(‘cvalue‘);
			//obj_cid存在是编辑,不存在则创建
			put += ‘<input type="hidden" cid="‘+oCid+‘" name="options[‘+num+‘].key" value="‘+oCid+‘">‘;
			put += ‘<input type="hidden" cid="‘+oCid+‘" name="options[‘+num+‘].value" value="‘+oVal+‘">‘;
		})	
		subOption.options = $(‘.bigAreatext‘).val();
		subOption.jsonOptions = jsonParseOptions;
	}
	//创建隐藏域
	var option = JSON.stringify(subOption.jsonOptions);
	option = option.replace(/"/g,""");
	var jsonOptions_hidden = "<input type="hidden" name="problem.jsonOptions" value=""+ option +"" />";
	var parentId_hidden = "<input type="hidden" name="problem.parentId" value=""+subOption.parentId+"" />";
	var hiddenParam = jsonOptions_hidden+parentId_hidden;
	put += hiddenParam;
	$(‘#hiddenParam‘).html(put);
	
	cidArr = [];
	$(‘#hiddenParam input[name*=value]‘).each(function(){
		var cid = $(this).attr(‘cid‘);
		cid = cid ? cid : "";
		cidArr.push(cid)
	})
}
function createPublishHidden_parent(type){
	//type=0表示初始化页面
	if(type === 0){
		var opt = $(‘.bigAreatext‘).val().split(‘
‘);
		var str = "";
		$(‘#disabledlab input[type=checkbox]‘).each(function(num, value){
			var obj_cid = $(value).attr(‘cid‘);
			var obj_val = opt[num];
			//obj_cid存在是编辑,不存在则创建
			str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].key" value="‘+obj_cid+‘">‘;
			str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].value" value="‘+obj_val+‘">‘;
		})
	}else{
		var str = "";
		$(‘#dialog-parentRelay .citem‘).each(function(num, value){
			var obj_cid = $(value).children(‘input[type=text]‘).attr(‘cid‘);
			var obj_val = $(value).children(‘input[type=text]‘).val();
			//obj_cid存在是编辑,不存在则创建
			if(obj_cid){
				str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].key" value="‘+obj_cid+‘">‘;
				str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].value" value="‘+obj_val+‘">‘;
			}else{
				str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].key" value="‘+obj_val+‘">‘;
				str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].value" value="‘+obj_val+‘">‘;
			}
		})
		
	}
	$(‘#hiddenParam‘).html(str)
}

function createUnPublishHidden_child(type){
	//保存数据
	subOption.parentId = $(‘#chooseProblemRelay‘).val();
	var str = "";
	var ret = {};
	//新增
	if(type){
		$(‘#dialog-problemRelay .child-item‘).each(function(num, value){
			var current = $(‘#parentItemSelect option‘).eq(num);
			var currentValue = current.val();
			//requireinput存在则手动添加#??#
			if(current.attr("requireinput")){
				currentValue = currentValue + "#??#";
			}
			var arr = [];
			$(this).find(‘.citem‘).each(function(num, value){
				var oVal = $.trim($(this).children(‘input[type=text]‘).val());
				if(oVal != ‘‘){
					str += oVal+"
";
					arr.push(oVal);
				}
			})
			ret[currentValue] = arr;
		})
		//去空值
		if(str.substr(-1) == ‘
‘){
			str = str.substr(0, str.length-1)
		}
		subOption.options = str;
		subOption.jsonOptions = ret;
	//初始化
	}else{
		subOption.options = $(‘.bigAreatext‘).val();
		subOption.jsonOptions = jsonParseOptions;
	}
	//创建隐藏域
	var option = JSON.stringify(subOption.jsonOptions);
	option = option.replace(/"/g,""");
	var jsonOptions_hidden = "<input type="hidden" name="problem.jsonOptions" value=""+ option +"" />";
	var parentId_hidden = "<input type="hidden" name="problem.parentId" value=""+subOption.parentId+"" />";
	var hiddenParam = jsonOptions_hidden+parentId_hidden;
	$(‘#hiddenParam‘).html(hiddenParam);
}
function createUnPublishHidden_parent(type){
	var options = JSON.stringify($(‘.bigAreatext‘).val());
	options = options.replace(/"/g,""");
	var html = ‘‘;
	var str = ‘‘;	
	//num=0表示初始化页面
	if(type === 0){
		var oldList = $(‘#oldtextarea‘).val().split(‘
‘);
		for(key in oldList){
			str += ‘<input type="hidden" name="optionKeys[‘+key+‘]" value="‘+oldList[key]+‘" />‘
		}
		$(‘#hiddenParam‘).html(hiddenParam);
	}else{
		$(‘#dialog-parentRelay .citem‘).each(function(num, value){
			var val = $(value).children(‘label‘).find(‘input[type=hidden]‘).val();
			if(val == ‘‘){
				val = $(value).children(‘input[type=text]‘).val();
			}
			str += ‘<input type="hidden" name="optionKeys[‘+num+‘]" value="‘+val+‘" />‘
		})
	}
	
	$(‘#oldHiddenParam‘).html(str);
}

  

/************************************************创建关系,根据发布情况************************************************************/function createPublishHidden_child(type){subOption.parentId = $(‘#chooseProblemRelay‘).val();var put = "";var str = "";var ret = {};var number = 0;//新增if(type){$(‘#dialog-problemRelay .child-item‘).each(function(num, value){var current = $(‘#parentItemSelect option‘).eq(num);var currentValue = current.val();//requireinput存在则手动添加#??#if(current.attr("requireinput")){currentValue = currentValue + "#??#";}var arr = [];$(this).find(‘.citem‘).each(function(num, value){var oVal = $.trim($(this).children(‘input[type=text]‘).val());var oCid = $(value).children(‘input[type=text]‘).attr(‘cid‘);if(oVal != ‘‘){str += oVal+" ";arr.push(oVal);}if(oCid){put += ‘<input type="hidden" cid="‘+oCid+‘" name="options[‘+number+‘].key" value="‘+oCid+‘">‘;put += ‘<input type="hidden" cid="‘+oCid+‘" name="options[‘+number+‘].value" value="‘+oVal+‘">‘;number++}else{if(oVal){put += ‘<input type="hidden" name="options[‘+number+‘].key" value="‘+oVal+‘">‘;put += ‘<input type="hidden" name="options[‘+number+‘].value" value="‘+oVal+‘">‘;number++}}})ret[currentValue] = arr;})//去空值if(str.substr(-1) == ‘ ‘){str = str.substr(0, str.length-1)}subOption.options = str;subOption.jsonOptions = ret;//初始化}else{$(‘#disabledlab input[type=checkbox]‘).each(function(num, value){var oCid = $(value).attr(‘cid‘);var oVal = $(value).attr(‘cvalue‘);//obj_cid存在是编辑,不存在则创建put += ‘<input type="hidden" cid="‘+oCid+‘" name="options[‘+num+‘].key" value="‘+oCid+‘">‘;put += ‘<input type="hidden" cid="‘+oCid+‘" name="options[‘+num+‘].value" value="‘+oVal+‘">‘;})subOption.options = $(‘.bigAreatext‘).val();subOption.jsonOptions = jsonParseOptions;}//创建隐藏域var option = JSON.stringify(subOption.jsonOptions);option = option.replace(/"/g,"&quot;");var jsonOptions_hidden = "<input type="hidden" name="problem.jsonOptions" value=""+ option +"" />";var parentId_hidden = "<input type="hidden" name="problem.parentId" value=""+subOption.parentId+"" />";var hiddenParam = jsonOptions_hidden+parentId_hidden;put += hiddenParam;$(‘#hiddenParam‘).html(put);cidArr = [];$(‘#hiddenParam input[name*=value]‘).each(function(){var cid = $(this).attr(‘cid‘);cid = cid ? cid : "";cidArr.push(cid)})}function createPublishHidden_parent(type){//type=0表示初始化页面if(type === 0){var opt = $(‘.bigAreatext‘).val().split(‘ ‘);var str = "";$(‘#disabledlab input[type=checkbox]‘).each(function(num, value){var obj_cid = $(value).attr(‘cid‘);var obj_val = opt[num];//obj_cid存在是编辑,不存在则创建str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].key" value="‘+obj_cid+‘">‘;str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].value" value="‘+obj_val+‘">‘;})}else{var str = "";$(‘#dialog-parentRelay .citem‘).each(function(num, value){var obj_cid = $(value).children(‘input[type=text]‘).attr(‘cid‘);var obj_val = $(value).children(‘input[type=text]‘).val();//obj_cid存在是编辑,不存在则创建if(obj_cid){str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].key" value="‘+obj_cid+‘">‘;str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].value" value="‘+obj_val+‘">‘;}else{str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].key" value="‘+obj_val+‘">‘;str += ‘<input type="hidden" cid="‘+obj_cid+‘" name="options[‘+num+‘].value" value="‘+obj_val+‘">‘;}})}$(‘#hiddenParam‘).html(str)}
function createUnPublishHidden_child(type){//保存数据subOption.parentId = $(‘#chooseProblemRelay‘).val();var str = "";var ret = {};//新增if(type){$(‘#dialog-problemRelay .child-item‘).each(function(num, value){var current = $(‘#parentItemSelect option‘).eq(num);var currentValue = current.val();//requireinput存在则手动添加#??#if(current.attr("requireinput")){currentValue = currentValue + "#??#";}var arr = [];$(this).find(‘.citem‘).each(function(num, value){var oVal = $.trim($(this).children(‘input[type=text]‘).val());if(oVal != ‘‘){str += oVal+" ";arr.push(oVal);}})ret[currentValue] = arr;})//去空值if(str.substr(-1) == ‘ ‘){str = str.substr(0, str.length-1)}subOption.options = str;subOption.jsonOptions = ret;//初始化}else{subOption.options = $(‘.bigAreatext‘).val();subOption.jsonOptions = jsonParseOptions;}//创建隐藏域var option = JSON.stringify(subOption.jsonOptions);option = option.replace(/"/g,"&quot;");var jsonOptions_hidden = "<input type="hidden" name="problem.jsonOptions" value=""+ option +"" />";var parentId_hidden = "<input type="hidden" name="problem.parentId" value=""+subOption.parentId+"" />";var hiddenParam = jsonOptions_hidden+parentId_hidden;$(‘#hiddenParam‘).html(hiddenParam);}function createUnPublishHidden_parent(type){var options = JSON.stringify($(‘.bigAreatext‘).val());options = options.replace(/"/g,"&quot;");var html = ‘‘;var str = ‘‘;//num=0表示初始化页面if(type === 0){var oldList = $(‘#oldtextarea‘).val().split(‘ ‘);for(key in oldList){str += ‘<input type="hidden" name="optionKeys[‘+key+‘]" value="‘+oldList[key]+‘" />‘}$(‘#hiddenParam‘).html(hiddenParam);}else{$(‘#dialog-parentRelay .citem‘).each(function(num, value){var val = $(value).children(‘label‘).find(‘input[type=hidden]‘).val();if(val == ‘‘){val = $(value).children(‘input[type=text]‘).val();}str += ‘<input type="hidden" name="optionKeys[‘+num+‘]" value="‘+val+‘" />‘})}$(‘#oldHiddenParam‘).html(str);}

以上是关于ceshi的主要内容,如果未能解决你的问题,请参考以下文章

ceshi

详解__FILE__与$_SERVER['SCRIPT_FILENAME']的区别

ceshi

java实现23种设计模式之代理模式

ceshi

ceshi