[Dev]Javascript
javascript e event
Overview : e.preventDefault는 고유 동작을 중단시키고,e.stopPropagation 는 상위 엘리먼트들로의 이벤트 전파를 중단시킨다.
javascript로 이중저장/결제 방지
Remark : 한페이지에서 Ajax 로 데이타 저장시 시간이 많이 걸릴 경우, 버튼이중 클릭시 중복저장됩니다. 버튼 disable 처리는 속성처리라 한번만 가능 ajax async: false 는 추천하지 않는 방식. […]
javascript 특수문자 체크
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
function CheckID(str) { var reg2 = /[a-z]/g; var reg3 = /\d/; return (reg2.test(str) && reg3.test(str) ); //var reg1 = /^[a-z0-9]{6,12}$/; //영문 또는 숫자 4-8자리인지 //var reg2 = /[a-z]/g; //문자중에 영문이 있는지 //var reg3 = /[0-9]/g; //문자중에 숫자가 있는지 //var reg4= /[!@#$]/g; //문자중에 특수문자가 있는지 //return (reg1.test(str) && reg2.test(str) && reg3.test(str) ); } |
1 2 3 4 5 6 7 8 9 10 11 |
if(!CheckID(frm.password.value)) { //alert("비밀번호는 영문소문자,특수문자(@#!$)와 숫자를 조합하여 생성해 주세요"); alert("비밀번호는 영문소문자와 숫자를 조합하여 생성해 주세요"); frm.password.value = ""; frm.passwordconf.value = ""; frm.password.focus(); return; } |
javascript Textbox enter 값입력
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<script language="javascript"> function enterkey() { //성명 엔터키 if (window.event.keyCode == 13) { //Action } } </script> <input name="txtname" type="text" id="txtname" onkeyup="enterkey()" size="18" /> |
[javascript] textarea 글자 제한
textarea 글자 제한 원본소스 다운로드 : textarea-maxlength Example 1 – (This is the default without any config) dfdsfsd Code used There is no javascript […]
JavaScript 업로드는 jpg와 gif 파일만 하실수 있습니다.
javascript GIF JPG
1 2 3 4 5 6 7 |
if((document.Frm.file1.value.toUpperCase().lastIndexOf(".JPG")==-1) && (document.Frm.file1.value.toUpperCase().lastIndexOf(".GIF")==-1)) { alert("업로드는 jpg와 gif 파일만 하실수 있습니다.") return false } |
ASP save
Google Apps Script Overview – Google Apps Script — Google Developers
Google Apps Script Overview – Google Apps Script — Google Developers.
팝업창 하루동안 띄우지 않기 소스
하루동안 띄우지 않는 소스 팝업창 안에 들어갈 소스는 아래와 같습니다
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<script language="javascript" type="text/javascript"> <!-- // 창닫기 function closeWin(winName, expiredays) { setCookie( winName, "done" , expiredays); var obj = eval( "window." + winName ); obj.style.display = "none"; } function closeWinAt00(winName, expiredays) { setCookieAt00( winName, "done" , expiredays); var obj = eval( "window." + winName ); obj.style.display = "none"; } --> </script> <input type="checkbox" name="close" value="OK" onclick="javascript:closeWin('div_laypopup', 1);"/>하루동안 이 창을 열지 않음 <!-- <input type="checkbox" name="close" value="OK" onclick="javascript:closeWinAt00('div_laypopup', 1);"/>오늘만 이 창을 열지 않음 --> |
Main 페이지 소스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
<script language="javascript" type="text/javascript"> <!-- // 쿠키 가져오기 function getCookie( name ) { var nameOfCookie = name + "="; var x = 0; while ( x <= document.cookie.length ) { var y = (x+nameOfCookie.length); if ( document.cookie.substring( x, y ) == nameOfCookie ) { if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) endOfCookie = document.cookie.length; return unescape( document.cookie.substring( y, endOfCookie ) ); } x = document.cookie.indexOf( " ", x ) + 1; if ( x == 0 ) break; } return ""; } function goPop(no){ var winName = "Popup1"; var blnCookie = getCookie( winName ); //alert( blnCookie); if( !blnCookie ) { window.open('http://www.test/test.asp?no=123','Popup1','width=760,height=1000,status=no,left=0,top=0,scrollbars=yes,resizable=no, menubar=no'); } } //setTimeout(goPop,1000); </script> |
[javascript] 오늘 하루동안 이 창을 열지 않음 ( 팝업,레이어팝업 ) […]
Javascript 롤링베너
소스 다운로드 : rollingbanner
HTML, Javascript에서 페이지 상단으로 스크롤 시키기
HTML에서는 <a href=”#top”>Back to top</a> 이런 식으로 하면 됩니다. Javascript에서는 window.location.href = ‘#top’ 이구요. 그런데 IE, FF에서는 위의 방법에 추가로 한가지를 더 해줘야 합니다. 페이지 […]
CSS Print Next page
//CSS .break { page-break-before: always; } //html <div class=”break”/>
javascript get span text value
function AllSelect(){ var cnt = document.Frm.E_COUNT.value document.Frm.Select_E.value=”A”; for (i=1;i<=cnt ;i++ ){ var all_E = eval(“E”+i+”.style”) //여러 object style속성까지 넘김 all_E.display=”; } for (i=1;i<=cnt ;i++ ){ […]
iframe 사용시 resize
1) iframe 사용 사이트 root 에 아래 내용 파일 resize.htm <script language=javascript> var arrtmp = location.href.split(“?”); var Params = arrtmp[1].split(“&”); var hei = Params[0]; var focus […]
웹화면에서 reload 계속 하기
<script> function re(){ location.reload(); } tid=setTimeout(re,13000); //13후에 reload </script>