Front-Html/Javascript
jquery의 분석
seongsland
2011. 12. 14. 11:28
아무생각없이 jquery의 편리함만 사용하고 있다가..
input type=file 에 대한 핸들링을 하다 아래의 내용을 확인함.
아래 내용은 테스트후 정리해볼것!
input type=file 에 대한 핸들링을 하다 아래의 내용을 확인함.
아래 내용은 테스트후 정리해볼것!
javascript select를 이용한 처리
1. 우선 선택을 해야된다.
document.getElementById("~").select();
2. 선택된것에 명령을 내린다.
document.execCommand("~", type1, type2);
- commend의 종류
: Paste
: Delete
: Copy
: Indent
: Outdent
: bold
: BackColor
: CreateLink
3. 기타
- input file 처리
: document.selection.createRange().text.toString(); -- 실 value값 불러오기 (IE8 보안문제 - fakepath)
: document.selection.empty();
: document.selection.clear(); -- 잘 안되는것 같음
jquery는 이 selection을 기준으로 셀렉트 연산자를 실행하는것 같다.
var SelText = window.getSelection();
document.getSelection();
document.selection.createRange().text;
SelText.type == "Text"..."None"
SelText.text;
SelText.htmlText;
SelText.pasteHTML("~~~~~~~~");
$(SelText).css("", "");
if (SelText.rangeCount && SelText.getRangeAt) {
range = SelText.getRangeAt(0);
}
SelText.removeAllRanges();
SelText.addRange(range);