index.html
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Input Counter</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="application.js" type="text/javascript"></script>
</head>
<body>
<div id="container">
<form action="index.html" method="POST">
<textarea></textarea>
<span class="input-counter"></span>
<input type="submit" id="input-submit" value="등록" />
</form>
</div>
</body>
</html>
stylesheet.js
body {
font-size: 12px;
background: #FFF;
color: #333;
margin: 0;
}
#container {
margin: 10px auto;
width: 500px;
padding: 10px;
background: #CCC;
}
form {
overflow: hidden;
height: 100%;
}
textarea {
display: block;
width: 99%;
height: 5.0em;
margin-bottom: 0.5em;
}
span.input-counter {
float: left;
font-weight: bold;
color: #000;
}
span.input-counter.disabled {
color: #F00;
}
input#input-submit {
float: right;
}
application.js
$(function() {
var maxLength = 140;
function updateInputCount() {
var textLength = $('textarea').val().length;
var count = maxLength - textLength;
$('span.input-counter').text(count);
if (count < 0) {
$('span.input-counter').addClass('disabled');
$('input#input-submit').prop('disabled', true);
} else {
$('span.input-counter').removeClass('disabled');
$('input#input-submit').prop('disabled', false);
}
}
$('textarea')
.focus(updateInputCount)
.blur(updateInputCount)
.keypress(updateInputCount);
window.setInterval(updateInputCount, 100);
updateInputCount();
});
게시글 목록
| 번호 | 제목 |
|---|---|
| 32341 | |
| 32339 | |
| 32326 | |
| 32325 | |
| 32322 | |
| 32319 | |
| 32318 | |
| 32316 | |
| 32315 | |
| 32313 | |
| 32312 | |
| 32311 | |
| 32310 | |
| 32304 | |
| 32303 | |
| 32300 | |
| 32293 | |
| 32292 | |
| 32291 | |
| 32285 | |
| 32284 | |
| 32275 | |
| 32271 | |
| 32268 | |
| 32265 | |
| 32261 | |
| 32258 | |
| 32257 | |
| 32255 | |
| 32254 | |
| 32253 | |
| 32251 | |
| 32250 | |
| 32249 | |
| 32247 | |
| 32246 | |
| 32245 | |
| 32244 | |
| 32243 | |
| 32242 | |
| 32241 | |
| 32240 | |
| 32239 | |
| 32238 | |
| 32237 | |
| 32236 | |
| 32232 | |
| 32229 | |
| 32228 | |
| 32227 | |
| 32217 | |
| 32215 | |
| 32214 | |
| 32213 | |
| 32211 | |
| 32207 | |
| 32196 | |
| 32193 | |
| 32192 | |
| 32190 | |
| 32188 | |
| 32186 | |
| 32184 | |
| 32173 | |
| 32172 | |
| 32171 | |
| 32167 | |
| 32165 | |
| 32163 | |
| 32162 | |
| 32158 | |
| 32157 | |
| 32155 | |
| 32151 | |
| 32149 | |
| 32135 | |
| 32132 | |
| 32127 | |
| 32125 | |
| 32122 | |
| 32120 | |
| 32119 | |
| 32117 | |
| 32116 | |
| 32115 | |
| 32114 | |
| 32112 | |
| 32111 | |
| 32109 | |
| 32107 | |
| 32104 | |
| 32103 | |
| 32102 | |
| 32101 | |
| 32094 | |
| 32089 | |
| 20404 | |
| 31036 | |
| 8279 | |
| 8268 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기