본문 바로가기

반응형

웹프로그래밍/Javascript

(29)
[Javascript] 페이지를 떠날 때 경고창 띄우기 다음과 같이 페이지를 벗어나기 전에, ‘수정사항이 있으니 다시 한번 확인해보세요’라는 메시지를 구현하는 방법에 대한 정리입니다. Javascript의 window.onBeforeUnload Event를 이용한 기능입니다. 실행시점 window.onBeforeUnload Event는 Window개체가 Unload되기 전에 실행됩니다. 정확하게 다음과 같은 시점이 있을 수 있습니다. 다만 IE 7, 8에서는 버그로 인해 다르게 동작하는 경우도 있으므로 참고가 필요합니다. 창이나 탭을 닫을 때 새로고침, 앞, 뒤로 이동버튼 클릭 시 location.href 변경 Form Submit 발생 시 A Tag 클릭 시 HREF에 URL을 지정한 경우: 발생 HREF에 #을 지정한 경우: 발생 안함 HREF에 java..
javascript ios app open self.location / window. not working ios app 을 웹 어플리케이션에서 킬때... 사파리에서는 안먹히는 것 해결
jquery ui dialog close button missing jquery-ui 의 dialog close 버튼이 안보일때 bootstrap.min.js 와 스크립트 충돌로 인한것으로 해당 스크립트를 우선순위를 바꾸거나 제외하면 정상적으로 보인다.
Javascript contains domain or email by string var url_regex = /(http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?)/gi; var email_regex = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi; var string = "도메인은 http://www.huzy.net/ 이고 이메일은 root@yjhoon.com 입니다."; var url_result = string.match(url_regex); => ["http://www.huzy.net/"] var email_result = string.match(email_regex); => [root@yjhoon.com"] result 값은 둘다 배열로 리턴되서 나옴 .
How to unset a JavaScript variable? I know this is an old thread, but the selected answer isn't clear enough for me. The point is the delete operator removes a property from an object. It cannot remove a variable. So the answer to the question depends on how the global variable or property is defined. (1) If it is created with var, it cannot be deleted. For example:var g_a = 1; //create with var, g_a is a variable delete g_a; //re..
[jQuery] .each $.each 순회중 continue, break 하기 jQuery에서 for, while 문과 비슷한 역할을 하는 each 메소드 사용 시 break, continue와 같은 프로세스를 수행해야 할 때가 있다. 그럴 때 return true;는 continue와 같은 역할을, return false;는 break와 같은 역할을 수행한다. 예제 >> $('#loop').each ( function() { if ( i==0 ) return true; // continue; else return false; // break; } ); 출처 :http://dhplanner.blogspot.kr/2009/06/jquery-each-%EB%A9%94%EC%86%8C%EB%93%9C-%EC%82%AC%EC%9A%A9%EC%8B%9C-break-continue-%EC%8..
밴드(BAND) 공유하기 정보(제목/내용/이미지) 스니핏 밴드 공유하기를 구현할때, 제목 내용 이미지를 넣고 싶었지만 아무리 공유하기를 눌러도 전달되지 않았다. window.open("http://www.band.us/plugin/share?body="+encodeURIComponent($("#docTitle").val() + "-" + $("#docAuthor").val())+encodeURIComponent("\n")+encodeURIComponent($("#docShortUrl").val())+"&route="+location.href, "share_band", "width=410, height=540, resizable=no"); (JSTL구문이 섞여있다...) 어쨋거나 body 파라미터에 제목\n주소 식으로 전달을 하면 밴드에 공유하기에 카드가 생긴다..
jQuery DatePicker 버튼 만들기 (동적 생성) 위와같이 할 경우 datepicker input 옆에 버튼이 생성된다. 이 버튼의 class는 ui-datepicker-trigger 를 가지므로 스타일시트에서 자신의 기호에 맞게 이미지를 배경으로 깔든 편하게 쓰면 된다.

반응형