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년 전 | 392 | ||
| 7829 |
|
9년 전 | 567 | |
| 7828 | 9년 전 | 501 | ||
| 7827 | 9년 전 | 386 | ||
| 7826 | 9년 전 | 403 | ||
| 7825 | 9년 전 | 444 | ||
| 7824 | 9년 전 | 426 | ||
| 7823 | 9년 전 | 339 | ||
| 7822 | 10년 전 | 331 | ||
| 7821 | 10년 전 | 283 | ||
| 7820 | 10년 전 | 329 | ||
| 7819 |
|
10년 전 | 731 | |
| 7818 | 10년 전 | 362 | ||
| 7817 | 10년 전 | 482 | ||
| 7816 | 10년 전 | 381 | ||
| 7815 | 10년 전 | 581 | ||
| 7814 | 10년 전 | 411 | ||
| 7813 | 10년 전 | 347 | ||
| 7812 | 10년 전 | 360 | ||
| 7811 | 10년 전 | 371 | ||
| 7810 | 10년 전 | 527 | ||
| 7809 | 10년 전 | 454 | ||
| 7808 | 10년 전 | 333 | ||
| 7807 | 10년 전 | 375 | ||
| 7806 |
프로그래머7
|
10년 전 | 1312 | |
| 7805 | 10년 전 | 1243 | ||
| 7804 |
zahir1312
|
10년 전 | 753 | |
| 7803 |
|
10년 전 | 1351 | |
| 7802 | 10년 전 | 431 | ||
| 7801 | 10년 전 | 840 | ||
| 7800 | 10년 전 | 1071 | ||
| 7799 | 10년 전 | 517 | ||
| 7798 | 10년 전 | 477 | ||
| 7797 | 10년 전 | 478 | ||
| 7796 | 10년 전 | 313 | ||
| 7795 | 10년 전 | 473 | ||
| 7794 | 10년 전 | 507 | ||
| 7793 | 10년 전 | 1021 | ||
| 7792 | 10년 전 | 425 | ||
| 7791 | 10년 전 | 516 | ||
| 7790 | 10년 전 | 473 | ||
| 7789 |
fbastore
|
10년 전 | 1413 | |
| 7788 | 10년 전 | 508 | ||
| 7787 | 10년 전 | 370 | ||
| 7786 | 10년 전 | 535 | ||
| 7785 | 10년 전 | 544 | ||
| 7784 | 10년 전 | 608 | ||
| 7783 | 10년 전 | 417 | ||
| 7782 | 10년 전 | 460 | ||
| 7781 | 10년 전 | 870 | ||
| 7780 | 10년 전 | 792 | ||
| 7779 | 10년 전 | 760 | ||
| 7778 | 10년 전 | 330 | ||
| 7777 | 10년 전 | 423 | ||
| 7776 | 10년 전 | 428 | ||
| 7775 | 10년 전 | 369 | ||
| 7774 | 10년 전 | 612 | ||
| 7773 | 10년 전 | 356 | ||
| 7772 | 10년 전 | 691 | ||
| 7771 | 10년 전 | 346 | ||
| 7770 | 10년 전 | 625 | ||
| 7769 | 10년 전 | 347 | ||
| 7768 | 10년 전 | 570 | ||
| 7767 | 10년 전 | 1138 | ||
| 7766 | 10년 전 | 462 | ||
| 7765 | 10년 전 | 491 | ||
| 7764 |
잘살아보자
|
10년 전 | 347 | |
| 7763 |
|
10년 전 | 1419 | |
| 7762 |
Tosea
|
10년 전 | 1030 | |
| 7761 | 10년 전 | 617 | ||
| 7760 |
잘살아보자
|
10년 전 | 641 | |
| 7759 |
잘살아보자
|
10년 전 | 468 | |
| 7758 |
잘살아보자
|
10년 전 | 557 | |
| 7757 | 10년 전 | 1208 | ||
| 7756 |
ITBANK
|
10년 전 | 1235 | |
| 7755 | 10년 전 | 1911 | ||
| 7754 | 10년 전 | 1027 | ||
| 7753 | 10년 전 | 853 | ||
| 7752 | 10년 전 | 1363 | ||
| 7751 |
잘살아보자
|
10년 전 | 492 | |
| 7750 |
잘살아보자
|
10년 전 | 451 | |
| 7749 |
잘살아보자
|
10년 전 | 456 | |
| 7748 |
잘살아보자
|
10년 전 | 445 | |
| 7747 |
잘살아보자
|
10년 전 | 545 | |
| 7746 |
잘살아보자
|
10년 전 | 656 | |
| 7745 |
잘살아보자
|
10년 전 | 894 | |
| 7744 |
잘살아보자
|
10년 전 | 399 | |
| 7743 | 10년 전 | 924 | ||
| 7742 |
starbros
|
10년 전 | 811 | |
| 7741 |
잘살아보자
|
10년 전 | 632 | |
| 7740 |
잘살아보자
|
10년 전 | 499 | |
| 7739 |
잘살아보자
|
10년 전 | 447 | |
| 7738 |
잘살아보자
|
10년 전 | 505 | |
| 7737 |
잘살아보자
|
10년 전 | 468 | |
| 7736 |
잘살아보자
|
10년 전 | 485 | |
| 7735 |
잘살아보자
|
10년 전 | 821 | |
| 7734 |
잘살아보자
|
10년 전 | 411 | |
| 7733 |
잘살아보자
|
10년 전 | 518 | |
| 7732 |
잘살아보자
|
10년 전 | 674 | |
| 7731 |
잘살아보자
|
10년 전 | 594 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기