첨부한 js ,css , 이미지 파일로 쉽게 트리 구조 만들기

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>
 <title>Destroydrop &raquo; Javascripts &raquo; Tree</title>

 <link rel="StyleSheet" href="dtree.css" type="text/css" />
 <script type="text/javascript" src="dtree.js"></script>

</head>

<body>

<h1><a href="/">Destroydrop</a> &raquo; <a href="/javascripts/">Javascripts</a> &raquo; <a href="/javascripts/tree/">Tree</a></h1>

<h2>Example</h2>

<div class="dtree">

 <p><a href="javascript: d.openAll();">open all</a> | <a href="javascript: d.closeAll();">close all</a></p>

 <script type="text/javascript">
  <!--

d = new dTree('d');                    

  d.add(0,-1,'My example tree');  
  d.add(1,0,'Node 1','example01.html');
  d.add(2,0,'Node 2','example01.html');
  d.add(3,1,'Node 1.1','example01.html');
  d.add(4,0,'Node 3','example01.html');
  d.add(5,3,'Node 1.1.1','example01.html');
  d.add(6,5,'Node 1.1.1.1','example01.html');
  d.add(7,0,'Node 4','example01.html');
  d.add(8,1,'Node 1.2','example01.html');
  d.add(9,0,'My Pictures','example01.html','Pictures I\'ve taken over the years','','','img/imgfolder.gif');
  d.add(10,9,'The trip to Iceland','example01.html','Pictures of Gullfoss and Geysir');
  d.add(11,9,'Mom\'s birthday','example01.html');
  d.add(12,0,'Recycle Bin','example01.html','','','img/trash.gif');

 

  document.write(d);
  //-->
 </script>

</div>

<p><a href="mailto&#58;drop&#64;destroydrop&#46;com">&copy;2002-2003 Geir Landr&ouml;</a></p>

</body>

</html>

 
블로그 이미지

스마트전

,

내용 복사하기 컨트롤+C 효과~

function copyUrl(url){
window.clipboardData.setData('Text',url);
}

------------------------------------------------------

window open 으로 창을 오픈하고 닫으면서 부모 창에 데이터 전달하기

function closewindow(elementId){
      window.close();
      window.opener.document.getElementById(elementId).value = paramDate;
      window.opener.document.getElementById(elementId1).value = paramDate1;
     window.opener.document.getElementById(elementId2).value = paramDate2;

  }

--------------------------------------------------------

자바스크립트로 location 할때   저는 주로 location.replace(returnUrl); 로 함 이유는 까먹음 더 좋다는것만 ㅋ


------------------------------------------------------------

주민등록 유효성 검사~~(실명인증은 아님) 주민번호 공식에 맞는지 체크

function document_check(){
   
   var u_id_no = document.getElementById("first_id_no").value;
   var test_no = u_id_no.substring(0,2);
   
   var u_id = u_id_no + document.getElementById("second_id_no").value;
   var m = parseInt(u_id.charAt(12));
   var sum = 0;
             
    for (i = 0, j = 2; i <= 11; i++) {
        sum = sum + parseInt(u_id.charAt(i)) * j;
         j = j + 1;
         if (j == 10) {
             j = 2;
          }
   }
             
  var rest = sum % 11;
  var gumsa = 11 - rest;
  var check_no = gumsa % 10;
   
   var coo = document.getElementById("id_check").checked;
         if (check_no != m) {
             alert("올바른 주민번호가 아닙니다.");
             document.getElementById("first_id_no").value = "";
             document.getElementById("second_id_no").value = "";
             document.getElementById("first_id_no").focus();
             return false;
         }
  }

------------------------------------------------------------------------

주민번호 등록양식에서 7자리 다 완성하면 그 다음 작성칸으로 포커스 자동 이동하기 (아래 예제에서maxlength 를 7로 하면 주민버호 앞 자리겠죠~? )

function moveFocus(obj,no,nextObj){
  if(obj.value.length == no){
   document.getElementById(nextObj).focus();
  }
 }
// HTML
 <input name="second_phone_no" type="text" id="second_phone_no" size="8" maxlength="4" onkeyup="moveFocus(this,4,'third_phone_no')" />

'Javascript' 카테고리의 다른 글

자바스크립트 arguments,args  (0) 2012.01.31
자바스크립트 기본 명령어 모음  (0) 2012.01.10
javascript 문자열 처리  (0) 2012.01.10
즐겨찾기 스크립트  (0) 2011.10.11
dTree 트리구조 쉽게 사용하기  (0) 2011.08.02
블로그 이미지

스마트전

,