###js
<html>
<head>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
var db = "";
var keyEventCheck = null;
function showstr() {
$("#displayText").html($("#inputText").val());
}
/*
function dd(){
if($("#inputText").val() ==''){
$("#inputText").val('1');
}
}
*/
function trick() {
if (db != $("#inputText").val()) {
showstr();
db = $("#inputText").val();
} else {
}
clearInterval(keyEventCheck);
keyEventCheck = setInterval("trick()", 100);
}
$(document).ready(function(){
$('#inputText').keydown(function(e){
trick();
});
});
</script>
</head>
<body>
<div id="displayText" style="border:1px solid red"></div>
<input type="text" id="inputText" name="inputText" />
<!--<button onclick="dd()">눌러</button>-->
</body>
</html>
'programming > javascript' 카테고리의 다른 글
DOM프로퍼티-노드프로퍼티--nodeName, nodeType, nodeValue (0) | 2012.08.07 |
---|---|
DOM 프로퍼티 - 노드내부 구조보기 -- childNodes, firstChild, lastChild, parentChild, nextSibling, previousSibling (0) | 2012.08.07 |
자바스크립트 키코드, 엘리먼트 객체 브라우져별 처리 (0) | 2012.05.03 |
자바스크립트 글자수 제한 (0) | 2012.04.25 |
lightbox2.0 익스플로러9에서 작동을 안한다. (0) | 2011.03.18 |