예전에 만들었던 AJAX 채팅방 업그레이드판 입니다.

jsp 기반으로 되어있으며 DB 는 필요없습니다.

테스트 주소 : http://cranix.net/CranixChatForAJAX

아래 소스는 이클립스 프로젝트를 그대로 export 한것입니다.

- 기본채팅
- 공개/비밀 방 생성
- FireFox 지원
- 오목(IE 전용)




2008/02/20 21:07 2008/02/20 21:07

크로스 브라우저 웹기반 위지윅 에디터를 만들려고 몇일간 삽질중이었다.

그러던중 IE 에서 자꾸 focus 가 달아나 버리는 이상한 현상이 발생했다.

색상선택기를 열심히 만들어서 클릭을 하면 에디터의 포커스가 없어져 버려서 색상이 바뀌지 않게 되는것이었다.

그런데 이상한건 다른 버튼들과 다른점이 없는데 그 버튼들은 되고 색상선택기만 안된다는것.!

연구에 연구를 거듭한 결과...(아니 삽질에 삽질..;;)

황당한 결과를 얻었다.

색상선택기는 테이블에다가 onclick 이벤트를 걸어서 구현한거고 나머지 버튼들은 이미지에다가 onclick 이벤트를 걸어서 작성했다.

결국 table 태그에 onclick 이벤트를 걸어서 클릭한건 포커스가 없어지고 image 태그에 onclick 이벤트를 걸어서 클릭한건 포커스가 그대로 남아있는것이었다.

이런 황당한 시츄에이션으로 색상선택기의 테이블에 걸려있는 onclick 이벤트를 싹빼주고 대신 투명 이미지를 덮어서 거기에 onclick 이벤트를 걸어줬더니 이상없이 잘 돌아간다.

버그.. 겠지?



2008/02/19 17:50 2008/02/19 17:50

IE 와 FF(firefox) 의 차이점

1. hand 는 웹표준이 아니여서 익스에서만 된다. 다음부턴 pointer 를 쓰자.

cursor:hand(x) --> cursor:pointer(0)



2. FF에서의 javascript 는 function 밖에서 변수 초기화가 되지 않는다.
예를들어 아래 소스를 보자.

var timeInterval = 5000;

function startInterval() {
setTimeout("test()",timeInterval);
}
function test() {
alert("hello!");
}
startInterval();

IE 에선 5초있다가 test() 를 실행하게되지만 FF 에선 바로 test() 가 실행된다.
이유는 timeInterval 이 초기화 되지 않기 때문이다.
유의하자.


3. FF 에선 selectSingleNode 와 같은 XPATH 탐색 함수가 지원되지 않는다.
예를들어 IE 의 아래와같은 구문은

var obj = xmlObj.selectSingleNode("root/subnode");

FF에선안되고 아래와 같이 바꿔야 IE,FF 모두 쓸수있다.

var obj = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("subnode")[0];

XPATH 가 웹표준이 아니었나? 상당히 편했는데 하루빨리 지원됬으면 좋겠다.


4. IE 에서 노드 탐색시 .text 로 텍스트를 불러올수있는데 FF 에선 불가능하다.
아래 소스는 IE 에서는 가능하나 FF 에선 불가능하다.

var text = xmlObj.getElementsByTagName("root")[0].text

모두 가능하게 하려면 아래 소스를 쓰자

var text = xmlObj.getElementsByTagName("root")[0].firstChild.nodeValue;



5. 위지윅 에디터 모드 변경법
IE 에서는 어떤 오브젝트든 contentEditable="true" 라는 플랙만 주면 에디터 모드가 된다. 예를들면 아래와 같다

<div id="editor" contentEditable="true"></div>

FF 에서는 아래와같이 javascript 로 designMode 를 On 시켜줘야 한다.

editor.contentDocument.designMode="On";

FF 에서는 document 객체에서 designMode 를 켜줘야 하기때문에 iframe 으로 써야한다.



2008/02/12 13:43 2008/02/12 13:43
TAG , ,

[font-style]

1. 'font-style: normal;'
2. 'font-style: italic;'
3. 'font-style: oblique;'

[font-weight]

1. "font-weight: normal;"
2. "font-weight: bold;"
3. "font-weight: bolder;"
4. "font-weight: lighter;"
5. "font-weight: 100"
6. "font-weight: 200"

[font-size]

1. "font-size: 12pt;"
2. "font-size: 16px;"
3. "font-size: 0.86cm;"
4. "font-size: 8.6mm;"
5. "font-size: 0.34in;"
6. "font-size: 200%;"

[font-variant]

1. "font-variant: normal;" : Cascading Style Sheets
2. "font-variant: small-caps;" : Cascading Style Sheets

[text-align]

1. "text-align: left;"
2. "text-align: justify;"

[text-indent]

1. "text-indent: 5px;"
2. "text-indent: 3em;"
3 "text-indent: 5cm;"

[text-decoration]

1. "text-decoration: none;"
2. "text-decoration: underline;"
3. "text-decoration: overline;"
4. "text-decoration: line-through;"
5. "text-decoration: line-through overline underline;"
6. "text-decoration: blink;"

[text-transform]

1. "text-transform: none;"
2. "text-transform: uppercase;"
3. "text-transform: lowercase;"
4. "text-transform: capitalize;"

[letter-spacing]

1. "letter-spacing: 1em;"

[word-spacing]

1. "word-spacing: 1em;"

[color]

1. "color: navy;"
2. "color: #369369;"
3. "color: rgb(80%,80%,80%);"
4. "color: rgb(111,111,999);"

[background-color]

1. "background-color: gray;"
2. "background-color: #EEEEEE;"
3. "background-color: rgb(80%,80%,80%);"

[background-image]

1. "background-image: url(list1.gif)"

[background-repeat]

1 "background-repeat: repeat;"
2. "background-repeat: repeat-x;"
3. "background-repeat: repeat-y;"
4. "background-repeat: no-repeat;"

[background-position]

1. "background-position: 10% 10%;"
2. "background-position: 1cm 1cm;"
3. "background-position: top;"
4. "background-position: center;"
5. "background-position: right bottom;"

[background-attachment]

1. "background-attachment: scroll;"
2. "background-attachment: fixed;"

[background]

1. "background: url(list1.gif) yellow no-repeat top left"

[padding]

1. "padding: 0 0 0 0; background-color: #EEEEEE;"
2. "padding: 50px; background-color: rgb(80%,80%,80%);"

[margin]

1. "margin: 0; background-color: #EEEEEE;"
2. "margin: 50px 50px 50px 50px; background-color: rgb(80%,80%,80%);"
3. "margin: 0 0 0 -30px; background-color: rgb(80%,80%,80%);"

[border-style]

1. "border-style: none;"
2. "border-style: solid;"
3. "border-style: dotted;"
4. "border-style: dashed;"
5. "border-style: double;"
6. "border-style: groove;"
7. "border-style: ridge;"
8. "border-style: inset;"
9. "border-style: outset;"
10. "border-style: solid dashed dotted outset;"



[border-width]

1. "border-width: 1px 1px 1px 1px;"
2. "border-width: 0 0 0 0; border-style: solid;"
3. "border-width: 1px 1px 1px 1px; border-style: solid;"
4. "border-width: 3px; border-style: solid;"
5. "border-width: 3mm; border-style: solid;"
6. "border-width: 1px 1cm 1mm 1in; border-style: solid;"
7. "border-width: thin; border-style: solid;"
8. "border-width: medium; border-style: solid;"
9. "border-width: thick; border-style: solid;"

[border]

1. "border: 1px;"
2. "border: #999999;"
3. "border: solid;"
4. "border: solid #999999;"
5. "border: 1px solid #999999"

[float]

1. "float: left;"

[visibility]

1. "visibility: visible;"
2. "visibility: hidden;"
3. "visibility: collapse;"

[list-style-type]

1 "list-style-type: default;"
2. "list-style-type: disc;"
3. "list-style-type: circle;"
4. "list-style-type: square;"
5. "list-style-type: decimal;"
6. "list-style-type: decimal-leading-zero;"
7. "list-style-type: lower-roman;"
8. "list-style-type: upper-roman;"
9. "list-style-type: lower-greek;"
10."list-style-type: lower-alpha;"
11."list-style-type: upper-latin;"
12."list-style-type: none;"

[list-style-image]

1. "list-style-image: url(list1.gif)"
2. "list-style-image: url(list2.gif)"

[list-style-position]

1. "list-style-position: inside"
2. "list-style-position: outside"

[list-style]

1 "list-style: url(list1.gif) inside;"
2. "list-style: square outside;"
3. "list-style: url(list1.gif);"
4. "list-style: square;"
5. "list-style: inside;"

[cursor]

1. cursor: auto;
2. cursor: crosshair;
3. cursor: default;
4. cursor: pointer;
5. cursor: move;
6. cursor: e-resize;
7. cursor: ne-resize;
8. cursor: nw-resize;
9. cursor: n-resize;
10. cursor: se-resize;
11. cursor: sw-resize;
12. cursor: s-resize;
13. cursor: w-resize;
14. cursor: text;
15. cursor: wait;
16. cursor: help;
17. cursor: url(list1.gif);




2008/02/04 01:30 2008/02/04 01:30