日期:2014-05-16  浏览次数:20416 次

js实现选中的checkbox的值
	function getSelectedIds()
	{
		var checkList = document.getElementsByName("selectKeyIds");
			
		if(checkList==null)
		{
			return "";
		}
			
		var strSelectedIds = "";
		
		for(var i=0; i<checkList.length; i++)
		{
			if(checkList[i].checked==true)
			{
				strSelectedIds += checkList[i].value + ",";
			}
		}
			
		if(strSelectedIds.substring(strSelectedIds.length-1, strSelectedIds.length)==",")
		{
			return strSelectedIds.substring(0, strSelectedIds.length - 1);
		}
		else
		{
			return strSelectedIds;
		}
	}

?