2009. 11. 27. 12:58 javascript
셀렉터 박스 관련
집에 가서 정리 하자
그냥 input type=text 를 입력 불가하게 만드는 소스
if(kind == '0') {
$('#url').attr("disabled", "disabled");
} else {
$('#url').removeAttr("disabled");
}
포커스를 가질 selectbox
$("#type1 > option[value=" + idx1 + "]").attr("selected", "true");
선택한 값을 추출 할때
$("#type1 > option:selected").val();
div 지우고 그릴때
$("div#thirdDepth").html("");
$("div#thirdDepth").append(content);
ajax 동기화가 필요할때 async : false,
function checkInput(parentId){
var inputKind = null;
data = "parentId="+parentId;
$.ajax({
url: "/xxxx/xxxx/checkInput",
type: "POST",
data: data,
dataType: "json",
async : false,
success: function(msg) {
if(msg.result == -1) {
alert("로그인 후 사용 가능한 기능 입니다.");
} else if(msg.result == -2) {
alert("중분류가 존재하지 않습니다.");
} else if(msg.result == -3) {
alert("이용 권한이 존재 하지 않습니다.");
} else{
inputKind = msg.inputKind;
}
},
error: function() {
alert("요청하신 서비스를 제공할수 없습니다. 관리자에게 문의 바랍니다.");
}
});
return inputKind;
}
ajax return 값이 list 일 경우
var list = msg.dataList;
for(var i=0; i<list.length; i++) {
var temp = list[i];
if(depth == '1' && idx == temp.idx) {
selectedFirstIdx = temp.idx;
} else if(depth == '2' && idx == temp.idx) {
selectedSecondIdx = temp.idx;
} else if(depth == '3' && idx == temp.idx) {
selectedThirdIdx = temp.idx;
}
content = content + "<option value=\"" + temp.idx + "\">" + temp.name + "</option>";
}
'javascript' 카테고리의 다른 글
익스 플로우 addEvent 관련 링크 (0) | 2010.12.14 |
---|---|
jquery ajax로 파일 업로드 할때 request.getParameter로 값을 못 얻어 올때 (0) | 2010.01.07 |
javascript undifined 메모 (0) | 2010.01.04 |
jquery ajax 호출 결과로 jsp 페이지에서 처리를 할때 (0) | 2009.12.31 |
ajax 한글처리 (0) | 2009.12.01 |