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개
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7830 | 9년 전 | 388 | ||
| 7829 |
|
9년 전 | 566 | |
| 7828 | 9년 전 | 495 | ||
| 7827 | 9년 전 | 383 | ||
| 7826 | 9년 전 | 389 | ||
| 7825 | 9년 전 | 441 | ||
| 7824 | 9년 전 | 424 | ||
| 7823 | 9년 전 | 330 | ||
| 7822 | 9년 전 | 325 | ||
| 7821 | 9년 전 | 273 | ||
| 7820 | 9년 전 | 325 | ||
| 7819 |
|
10년 전 | 730 | |
| 7818 | 10년 전 | 355 | ||
| 7817 | 10년 전 | 467 | ||
| 7816 | 10년 전 | 374 | ||
| 7815 | 10년 전 | 576 | ||
| 7814 | 10년 전 | 403 | ||
| 7813 | 10년 전 | 341 | ||
| 7812 | 10년 전 | 352 | ||
| 7811 | 10년 전 | 368 | ||
| 7810 | 10년 전 | 516 | ||
| 7809 | 10년 전 | 445 | ||
| 7808 | 10년 전 | 317 | ||
| 7807 | 10년 전 | 369 | ||
| 7806 |
프로그래머7
|
10년 전 | 1311 | |
| 7805 | 10년 전 | 1236 | ||
| 7804 |
zahir1312
|
10년 전 | 751 | |
| 7803 |
|
10년 전 | 1350 | |
| 7802 | 10년 전 | 416 | ||
| 7801 | 10년 전 | 838 | ||
| 7800 | 10년 전 | 1069 | ||
| 7799 | 10년 전 | 511 | ||
| 7798 | 10년 전 | 471 | ||
| 7797 | 10년 전 | 467 | ||
| 7796 | 10년 전 | 310 | ||
| 7795 | 10년 전 | 463 | ||
| 7794 | 10년 전 | 492 | ||
| 7793 | 10년 전 | 1016 | ||
| 7792 | 10년 전 | 418 | ||
| 7791 | 10년 전 | 505 | ||
| 7790 | 10년 전 | 469 | ||
| 7789 |
fbastore
|
10년 전 | 1409 | |
| 7788 | 10년 전 | 501 | ||
| 7787 | 10년 전 | 362 | ||
| 7786 | 10년 전 | 523 | ||
| 7785 | 10년 전 | 537 | ||
| 7784 | 10년 전 | 605 | ||
| 7783 | 10년 전 | 412 | ||
| 7782 | 10년 전 | 455 | ||
| 7781 | 10년 전 | 868 | ||
| 7780 | 10년 전 | 789 | ||
| 7779 | 10년 전 | 757 | ||
| 7778 | 10년 전 | 324 | ||
| 7777 | 10년 전 | 416 | ||
| 7776 | 10년 전 | 417 | ||
| 7775 | 10년 전 | 360 | ||
| 7774 | 10년 전 | 608 | ||
| 7773 | 10년 전 | 348 | ||
| 7772 | 10년 전 | 682 | ||
| 7771 | 10년 전 | 337 | ||
| 7770 | 10년 전 | 619 | ||
| 7769 | 10년 전 | 339 | ||
| 7768 | 10년 전 | 559 | ||
| 7767 | 10년 전 | 1128 | ||
| 7766 | 10년 전 | 458 | ||
| 7765 | 10년 전 | 486 | ||
| 7764 |
잘살아보자
|
10년 전 | 339 | |
| 7763 |
|
10년 전 | 1405 | |
| 7762 |
Tosea
|
10년 전 | 1027 | |
| 7761 | 10년 전 | 615 | ||
| 7760 |
잘살아보자
|
10년 전 | 630 | |
| 7759 |
잘살아보자
|
10년 전 | 440 | |
| 7758 |
잘살아보자
|
10년 전 | 542 | |
| 7757 | 10년 전 | 1194 | ||
| 7756 |
ITBANK
|
10년 전 | 1230 | |
| 7755 | 10년 전 | 1907 | ||
| 7754 | 10년 전 | 1017 | ||
| 7753 | 10년 전 | 847 | ||
| 7752 | 10년 전 | 1357 | ||
| 7751 |
잘살아보자
|
10년 전 | 481 | |
| 7750 |
잘살아보자
|
10년 전 | 446 | |
| 7749 |
잘살아보자
|
10년 전 | 449 | |
| 7748 |
잘살아보자
|
10년 전 | 437 | |
| 7747 |
잘살아보자
|
10년 전 | 535 | |
| 7746 |
잘살아보자
|
10년 전 | 649 | |
| 7745 |
잘살아보자
|
10년 전 | 889 | |
| 7744 |
잘살아보자
|
10년 전 | 394 | |
| 7743 | 10년 전 | 922 | ||
| 7742 |
starbros
|
10년 전 | 803 | |
| 7741 |
잘살아보자
|
10년 전 | 624 | |
| 7740 |
잘살아보자
|
10년 전 | 490 | |
| 7739 |
잘살아보자
|
10년 전 | 446 | |
| 7738 |
잘살아보자
|
10년 전 | 502 | |
| 7737 |
잘살아보자
|
10년 전 | 461 | |
| 7736 |
잘살아보자
|
10년 전 | 478 | |
| 7735 |
잘살아보자
|
10년 전 | 812 | |
| 7734 |
잘살아보자
|
10년 전 | 408 | |
| 7733 |
잘살아보자
|
10년 전 | 515 | |
| 7732 |
잘살아보자
|
10년 전 | 667 | |
| 7731 |
잘살아보자
|
10년 전 | 588 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기