Development/JavaScript2007/01/09 17:01
정규표현식

1. 각 문자와 숫자는 해당 문자 또는 문자열이 테스트할 문자열에 있을경우 true 가된다.
<script>
// 'a' 가 있는 문자열 모두가 TRUE (대소문자 구분)
var filter = /a/
if (filter.test("some test words") == true) { alert("ok"); } else { alert("fail"); }
</script>

<script>
// "about" 가 있는 문자열 모두가 TRUE (대소문자 구분)
var filter = /about/
if (filter.test("some test words") == true) { alert("ok"); } else { alert("fail"); }
</script>


2. 대소문자 구분없이 해당 문자 또는 문자열을 검색할 경우 끝에 i 를 붙인다.
<script>
// 'a' 또는 'A' 가 있는 문자열 모두가 TRUE (대소문자 구분 안함)
var filter = /a/i
if (filter.test("some test words") == true) { alert("ok"); } else { alert("fail"); }
</script>


3. 여러개의 이어지는 내용들을 검색할 경우는 '-' 를 넣어 표현한다.
<script>
// 'a' 에서 'z' 까지중 하나만 있으면 모두가 TRUE (대소문자 구분)
var filter = /[a-z]/
if (filter.test("some test words") == true) { alert("ok"); } else { alert("fail"); }
</script>


4. 여러가지의 문자 또는 문자열을 검색할 경우 '|' 를 넣는다.
<script>
// 'a' 또는 'b' 또는 'c' 가 있는 문자열 모두가 TRUE (대소문자 구분)
var filter = /a|b|c/
if (filter.test("some test words") == true) { alert("ok"); } else { alert("fail"); }
</script>

<script>
// 'a' 에서 'z' 까지 또는 '0' 에서 '9' 까지중 하나만 있으면 모두가 TRUE (대소문자 구분)
var filter = /[a-z]|[0-9]/
if (filter.test("some test words") == true) { alert("ok"); } else { alert("fail"); }
</script>


5. 해당 문자또는 문자열이 없는 경우를 검색할 경우 브래킷('[', ']') 안에 '^' 를 넣는다.
<script>
// 'a' 에서 'z' 까지의 문자가 아닌 문자가 있을 경우 TRUE (대소문자 구분)
var filter = /[^a-z]/
if (filter.test("some test words") == true) { alert("ok"); } else { alert("fail"); }
</script>


6. 문자열의 첫번째 글자가 일치해야할 경우는 '^' 를 브래킷('[', ']') 밖에 넣는다.
<script>
// 'a' 에서 'z' 까지의 문자로 시작하는 문자열일 겨우 TRUE (대소문자 구분)
var filter = /^[a-z]/
if (filter.test("some test words") == true) { alert("ok"); } else { alert("fail"); }
</script>


7. 문자열의 끝쪽 글자가 해당 문자 또는 문자열과 일치해야할 경우는 '$' 를 넣쨈?
<script>
// 'a' 에서 'z' 까지의 문자로 끝나는 문자열일 겨우 TRUE (대소문자 구분)
var filter = /[a-z]$/
if (filter.test("some test words") == true) { alert("ok"); } else { alert("fail"); }
</script>


8. 특수문자('\', '^', '$', '*', '+', '?', '.', '(', ')', '|', '{', '}', '[', ']')를 검색할 경우는 '\' 를 넣는다.
<script>
// '\' 가 있는 문자열일 겨우 TRUE (대소문자 구분)
var filter = /\\/
if (filter.test("some test words") == true) { alert("ok"); } else { alert("fail"); }
</script>


출처: http://edn.episode.co.kr/language/js/faq/
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by Blue*
Development/JavaScript2006/03/19 21:44

<script>

/*

* MS 익스플로러 명령 실행 함수

*/

function ieExecWB( intOLEcmd, intOLEparam ) {

// 웹 브라우저 컨트롤 생성

var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 '

                           + ' CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">'

                           + '</OBJECT>';



// 웹 페이지에 객체 삽입

document.body.insertAdjacentHTML('beforeEnd', WebBrowser);

// intOLEparam이 정의되어 있지 않으면 디폴트 값 설정

if ( ( ! intOLEparam ) || ( intOLEparam < -1 )  || (intOLEparam > 1 ) )

intOLEparam = 1;

// ExexWB 메쏘드 실행

WebBrowser1.ExecWB( intOLEcmd, intOLEparam );

// 객체 해제

WebBrowser1.outerHTML = "";

}

</script>



* 사용 예제

<input type=button value="인쇄 미리 보기" onclick="window.ieExecWB(7)">

<input type=button value="페이지 설정" onclick="window.ieExecWB(8)">

<input type=button value="인쇄하기(대화상자 표시)" onclick="window.ieExecWB(6)">

<input type=button value="인쇄 바로 하기" onclick="window.ieExecWB(6, -1)">

<input type=button value="웹페이지 저장" onclick="window.ieExecWB(4, 1)">





출처 : http://blog.naver.com/ecogeo/100010940924

크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by Blue*
Development2006/03/15 14:51

moo.fx v1.2 is out! The biggest improvement? Documentation!

moo.fx changelog:

  • I've moved the animation logic, now you can use custom transitions (found in the bottom of both moo.fx and moo.fx.pack).
  • Opacity effect has been modified, works better in safari and now you can call the setOpacity method to sudden set the opacity (crossbrowser) without displaying the effect.

moo.fx.pack changelog:

  • No more fx.FadeSize. use the new fx.Combo, supports any combination between height, width and opacity.
  • No more fx.Multi. Use the new fx.Accordion, to generate accordions in 1 line of code!!
  • No more parseClassNames (it was lame)

Want to use transitions and opacity improvements but don't want to change your existing code? Just download moo.fx.js and use the old moo.fx.pack.js.

update: moo.fx.js is now 1.2.3. Fixed some Internet explorer memory leaks. Upgrade if you can!.





출처 : http://moofx.mad4milk.net/

크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by Blue*
Development2006/03/15 14:49

prototype 이 상당한 인기를 구가하고 있는 듯 하다.

특히 ajax 와 같이 js 가 많이 요구되는 경우에는

프레임워크 형태로 js 를 쓰지 않으면

디버깅 등의 문제로 골머리를 앓을테니



오늘 여러 사이트에서 관련 가이드가 여기 저기 소개되었다.



Developer Notes for prototype.js : http://www.sergiopereira.com/articles/prototype.js.html

Quick Guide to Prototype

Overview of the Prototype Library

Easy Ajax with Prototype



Download Prototype 1.4





더불어.. 이 녀석도

Download Script.aculo.us 1.5





출처 : http://blog.empas.com/ahnyounghoe/read.html?a=11580379

크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by Blue*