모두 삭제 JS

4009 단어 IE

// checkbox
	  function selectCheck()
	  {
	  	for(var i=0;i<document.forms[0].elements.length; i++)
	  	{
	  		if(document.forms[0].elements[i].type=='checkbox')
	  		{
	  			if(document.forms[0].elements[i].checked==true)
	  			{
	  				return true;
	  			}
	  		}
	  	}
	  	return false;
	  }
      
      
	  function delSelect()
	  {
	    var select="";
	     
	  	if(!selectCheck())
	  	{
	  		alert(" !");
	  		return;
	  	}
	
	    // , null
		if(document.all.checknum.length==null)
		{
			select += document.all.checknum.value + ",";
		}
		
		// 
		for(var i = 0; i < document.all.checknum.length; i ++)
		{
			if(document.all.checknum[i].checked == true)
			{
				select += document.all.checknum[i].value + ",";
			}
		}
		if(confirm(" , ?"))
		{
			// 
			select = select.substr(0, select.length - 1);
			alert(select);
			document.forms[0].action="ylajax.do?Method=deleteRow&select="+select;
			document.forms[0].submit();
			return ;
		}
  	}

<td><input type="checkbox" name="checknum" value=<bean:write name="s" property="sno"/>></td>


ACTION:
public ActionForward deleteRow(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) 
	{
		StudentForm sg = (StudentForm)form;
		List<String> list = new ArrayList<String>();
		String check = request.getParameter("select");
		String [] id = check.split(",");
		for (int i = 0; i < id.length; i++) 
		{
			list.add(id[i]);
		}
		ProccessStu.getStu().delStudentTex(list);
		List<StudentTex> lists = ProccessStu.getStu().getStudentTex();
		sg.setStu(lists);		
		return mapping.findForward("initial");
	} 
// ----------------------------------------------------------------------------------
function selectAll()
{
  	for(var i=0;i<document.forms[0].elements.length;i++)
  	{
  		if(document.forms[0].elements.type='checkbox')
  		{
  			if(document.forms[0].check.checked==true)
  			{
  		document.forms[0].elements[i].checked=true;	
  			}
  			else
  			{
  		document.forms[0].elements[i].checked=false;
  			}
  		}
  	}
}

<input type="checkbox" name="check" onClick="selectAll();" >
 -----------------------------------------------------------------
function openwindow( url, winName, width, height)
{
	xposition=0; yposition=0;
	if((parseInt(navigator.appVersion) >= 4 ))
	{
	  xposition = (screen.width - width) / 2;
	  yposition = (screen.height - height) / 2;
	}
	theproperty ="width=" + width + "," + "height=" + height + "," + "location=0," + "menubar=0," + "resizable=1," 	+ "scrollbars=0," + "status=0," + "titlebar=0,"
	+ "toolbar=0," + "hotkeys=0," + "screenx=" + xposition + "," // Netscape
	+ "screeny=" + yposition + "," // Netscape
	+ "left=" + xposition + "," //IE
	+ "top=" + yposition; //IE
	window.open( url,winName,theproperty );
}

JS ---------------------------------------------------------------------------
<html:file property='uploadFile' styleClass="btn" size="50" onkeydown="if(event.keyCode!=9 && (event.keyCode<35 || event.keyCode>40)) return false;"/>


좋은 웹페이지 즐겨찾기