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();
});
댓글 1개
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 430 | 19년 전 | 4094 | ||
| 429 | 19년 전 | 3289 | ||
| 428 | 19년 전 | 4125 | ||
| 427 | 19년 전 | 3465 | ||
| 426 | 19년 전 | 3099 | ||
| 425 | 19년 전 | 3393 | ||
| 424 | 19년 전 | 2435 | ||
| 423 | 19년 전 | 2854 | ||
| 422 | 19년 전 | 2343 | ||
| 421 | 19년 전 | 3703 | ||
| 420 | 19년 전 | 4728 | ||
| 419 | 19년 전 | 3783 | ||
| 418 |
|
19년 전 | 1736 | |
| 417 | 19년 전 | 2740 | ||
| 416 | 19년 전 | 2386 | ||
| 415 | 19년 전 | 2602 | ||
| 414 | 19년 전 | 4401 | ||
| 413 |
|
19년 전 | 2586 | |
| 412 | 19년 전 | 3036 | ||
| 411 |
|
19년 전 | 2983 | |
| 410 |
|
19년 전 | 3672 | |
| 409 |
|
19년 전 | 3627 | |
| 408 |
|
19년 전 | 1848 | |
| 407 | 19년 전 | 2222 | ||
| 406 | 19년 전 | 2774 | ||
| 405 | 19년 전 | 2438 | ||
| 404 | 19년 전 | 4292 | ||
| 403 | 19년 전 | 3298 | ||
| 402 |
NeoGenesis
|
19년 전 | 4085 | |
| 401 | 19년 전 | 2600 | ||
| 400 |
|
19년 전 | 2486 | |
| 399 | 19년 전 | 2948 | ||
| 398 | 19년 전 | 2479 | ||
| 397 | 19년 전 | 2776 | ||
| 396 | 19년 전 | 2466 | ||
| 395 | 19년 전 | 3173 | ||
| 394 | 19년 전 | 1708 | ||
| 393 | 19년 전 | 2985 | ||
| 392 | 19년 전 | 2243 | ||
| 391 | 19년 전 | 2174 | ||
| 390 | 19년 전 | 2276 | ||
| 389 | 19년 전 | 2640 | ||
| 388 | 19년 전 | 2145 | ||
| 387 | 19년 전 | 4477 | ||
| 386 |
|
19년 전 | 2679 | |
| 385 |
|
19년 전 | 2472 | |
| 384 | 19년 전 | 2998 | ||
| 383 | 19년 전 | 3042 | ||
| 382 | 19년 전 | 3098 | ||
| 381 |
|
19년 전 | 2627 | |
| 380 |
|
19년 전 | 3010 | |
| 379 | 19년 전 | 2542 | ||
| 378 | 19년 전 | 2201 | ||
| 377 | 19년 전 | 2775 | ||
| 376 | 19년 전 | 2465 | ||
| 375 |
|
19년 전 | 2552 | |
| 374 | 19년 전 | 3806 | ||
| 373 | 19년 전 | 3260 | ||
| 372 | 19년 전 | 4982 | ||
| 371 |
세은아빠2
|
19년 전 | 2408 | |
| 370 | 19년 전 | 4495 | ||
| 369 | 19년 전 | 3104 | ||
| 368 | 19년 전 | 2886 | ||
| 367 | 19년 전 | 3721 | ||
| 366 | 19년 전 | 2637 | ||
| 365 | 19년 전 | 3727 | ||
| 364 | 19년 전 | 4004 | ||
| 363 | 19년 전 | 3428 | ||
| 362 | 19년 전 | 3470 | ||
| 361 | 19년 전 | 4097 | ||
| 360 |
hwatta
|
19년 전 | 2354 | |
| 359 | 19년 전 | 5095 | ||
| 358 | 19년 전 | 3649 | ||
| 357 | 19년 전 | 2589 | ||
| 356 |
sdesign1s
|
19년 전 | 2270 | |
| 355 | 20년 전 | 2741 | ||
| 354 | 20년 전 | 3021 | ||
| 353 | 20년 전 | 2785 | ||
| 352 |
|
20년 전 | 5765 | |
| 351 |
|
20년 전 | 2697 | |
| 350 |
|
20년 전 | 4282 | |
| 349 |
hwatta
|
20년 전 | 2175 | |
| 348 | 20년 전 | 7303 | ||
| 347 | 20년 전 | 2407 | ||
| 346 | 20년 전 | 3493 | ||
| 345 | 20년 전 | 4299 | ||
| 344 | 20년 전 | 2629 | ||
| 343 | 20년 전 | 3913 | ||
| 342 | 20년 전 | 3061 | ||
| 341 | 20년 전 | 4081 | ||
| 340 |
|
20년 전 | 5124 | |
| 339 |
|
20년 전 | 4225 | |
| 338 | 20년 전 | 5858 | ||
| 337 | 20년 전 | 2033 | ||
| 336 |
|
20년 전 | 3304 | |
| 335 |
|
20년 전 | 3531 | |
| 334 |
|
20년 전 | 2914 | |
| 333 |
hwatta
|
20년 전 | 2424 | |
| 332 | 20년 전 | 4647 | ||
| 331 | 20년 전 | 2262 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기