1. <script type="text/javascript">
  2. //<![CDATA[
  3.   alert(parseInt("045646"));  //parseInt일 경우, 0으로 시작하는 문자는 8진수로 변환되어 19366을 출력.
      alert(parseInt("045646", 10)); //parseInt일 경우, 0으로 시작하는 문자는 10진수라는 것을 표시해줘야 45646으로 나온다.
                                    // 아니면 위와 같이 8진수로 변환된 값이 나온다.
    alert(Number("045646") + Number("098646")); //Number일 경우에는 기본 10진수로 나오기 때문에 0으로 시작하는 문자라도
                                                  //위와 같은 문제는 생기지 않는다.
    alert(parseInt("0x45646")); //parseInt일 경우 , 0x로 시작하는 문자는 16진수로 계산하여 284230 출력
  4. //]]>
  5. </script>


    누가 써놨는지 임시 저장본이 있어서 내가 가로챔.
Posted by 윤재현 :

자바스크립트 부분
<script type="text/javascript">
<!--
function allCk(objCheck){ //전체 선택 checkbox 클릭
  var checks = document.getElementsByName('cp_no');
  for( var i = 0; i < checks.length; i++ ){
   checks[i].checked = objCheck;
// name이 'cp_no' 인 checkbox는  id가 allck인 checkbox의 checked 상태와 같게 된다. 

  }
 }

function deleteGo(){ //여러 게시물을 선택하고 삭제하기
  var listForm = document.getElementById("listForm");
  listForm.action = "../cafe/cafeDelete.jsp?blc_no=<%=blc_no%>";
  listForm.submit();
 }
 //-->
</script>

jsp 부분

<form name="listForm" id="listForm" action="" method="post">
<input type="checkbox" id="allck" name="allck"  onclick="allCk(this.checked);">
<%
int vectorSize = 5;
for( int i=0; i<vectorSize; i++ ){
%>
<input type="checkbox" name="cp_no" value="<%=(i+1)%>" >
<%
}
%>
<a href="#" onclick="deleteGo(); return false;"><img src="../files/images/boardCafe/btn_remove.gif" alt="삭제" /></a>
</form>

java 부분

String[] cp_no = getParameterValues("cp_no");
String whereStr = "";
//getParameterValues를 이용 배열로 받는다.
 if( cp_no.length != 0 ){
          whereStr = " and  cp_no in ( ";  // in(or)이용
          for( int i=0; i<cp_no.length; i++ ){ //배열의 길이만큼 for문으로 돌린다
whereStr += cp_no[i];
  if( i != (cp_no.length-1) ){
whereStr += " , ";
  }
          }
whereStr += " )  ";
 }
 buffer.append(" UPDATE TBLCAFEPOST SET ")
                  .append(" CP_ISDELETE = 'Y'")
                  .append(" where blc_no = ").append(utilBean.convertDB(getParameter("blc_no")))
                  append(whereStr); 
            
            query = buffer.toString();
       
            buffer.delete(0, buffer.length());
            iAffected = stmt.executeUpdate(query);
            if ( iAffected != 1 ) {
              throw new SQLException("ERROR! " + iAffected + " rows effected, QUERY : " + query);
            } else {
              htReturn.put("isOK", "Y"); //Hashtable에 성공 여부 저장
            }


Posted by 알 수 없는 사용자 :
Flash: getURL 방식 이 아닌 External모듈을 사용
import flash.external.*;
ExternalInterface.call("javascript_function_name" , parameters ... );
Html: Object 와 embed 에 id,name 값 추가, parameter 추가
<object classid=........id="이름">
<param value="always" name="allowScriptAccess"/>
<embed src="경로" name="이름" allowscriptaccess="always" />
</object>

-특별히 셜명할 사항은 없으나 , getURL에서는 ID값과 Name값이 아무관계없이 연동되지만 External모듈을 사용할때는 Object,embed의 ID값과 Name값을 명시해줘야 된다.

내용이 너무 적어서 한가지 더 적자면 하이퍼 링크 연결시 Parameter값을 넘겨줄때 &-->&amp;를  적어주자 &amp;가 표준이고 -_- ; 플래쉬 연동시 &기호면 넣으면 에러가 발생한다.
Posted by 알 수 없는 사용자 :