본문 바로가기
728x90
반응형
SMALL

JavaScript21

ip address to number & number to ip address /** * dot(.) 형태의 IP Address 를 number(long) 형태로 변경 * @author young-hoi.kim * @param str * @returns */function ipAddrToNum(str) { var d = str.split('.'); return ((((((+d[0])*256)+(+d[1]))*256)+(+d[2]))*256)+(+d[3]);} /** * number(long) 형태의 IP Address 를 dot(.) 형태로 변경 * @author young-hoi.kim * @param num * @returns {Number} */function numToIpAddr(num) { var d = num%256; for (var i = 3; i > 0; i--) {.. 2013. 12. 23.
부모창에서 자식창으로 데이터 보내기 // opener source function popView(val, pWidth, pHeight) { window.open('${contextRoot}/log/resource/resource/chart/','','width=1024;height=900;scrollbars=yes'); } function setData(opObj) { opObj.innerHTML = $('#testElements').val(); } // pop-up source Pop-up Test 2013. 12. 23.
JavaScript 로 AD(Active Directory) 로그인 여부 확인 하기 function loadTest(){ try{ var objSysInfo=new ActiveXObject("ADSystemInfo"); var userName = objSysInfo.UserName; if(undefined !== userName && null !== userName){ var WshNetwork = new ActiveXObject("WScript.Network"); var userId = WshNetwork.UserName; document.write("Login by AD with "+userId); // 로그인 처리 } }catch(e){ var errCode = (e.number & 0xFFFF); if( errCode === 1332){// No Login by AD. }else.. 2013. 12. 23.
자바스크립트 핵심 가이드 - (배열 메소드) array.concat(item...) : 자신의 복사본에 인수로 넘어온 값들을 추가한 새로운 배열을 반환한다. 인수로 넘어온 값이 배열이면 각각의 요소를 개별적으로 새로운 배열에 추가 한다. var a = ['a', 'b', 'c']; var b = ['x', 'y', 'z']; var c = a.concat(b, true); // c는 ['a', 'b', 'c', 'x', 'y', 'z', true] array.push(item...) : push 메소드는 인수로 넘어온 항목을 배열의 끝에 추가한다. concat 과 다르게 push 는 배열 자체를 수정하여 넘어온 인수 전체를 배열에 추가 한다. 반환 값은 배열의 새로운 length 값이다. var a = ['a', 'b', 'c']; var b = .. 2013. 12. 23.
728x90
반응형
LIST