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개
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7730 | 10년 전 | 1290 | ||
| 7729 | 10년 전 | 1102 | ||
| 7728 |
잘살아보자
|
10년 전 | 567 | |
| 7727 |
잘살아보자
|
10년 전 | 464 | |
| 7726 |
잘살아보자
|
10년 전 | 798 | |
| 7725 |
잘살아보자
|
10년 전 | 530 | |
| 7724 |
잘살아보자
|
10년 전 | 435 | |
| 7723 |
잘살아보자
|
10년 전 | 503 | |
| 7722 |
잘살아보자
|
10년 전 | 443 | |
| 7721 |
잘살아보자
|
10년 전 | 481 | |
| 7720 |
잘살아보자
|
10년 전 | 422 | |
| 7719 |
비긴어게인
|
10년 전 | 667 | |
| 7718 |
|
10년 전 | 2504 | |
| 7717 |
잘살아보자
|
10년 전 | 635 | |
| 7716 |
잘살아보자
|
10년 전 | 376 | |
| 7715 |
잘살아보자
|
10년 전 | 409 | |
| 7714 |
잘살아보자
|
10년 전 | 452 | |
| 7713 | 10년 전 | 1755 | ||
| 7712 | 10년 전 | 1686 | ||
| 7711 | 10년 전 | 1070 | ||
| 7710 | 10년 전 | 1358 | ||
| 7709 | 10년 전 | 1490 | ||
| 7708 | 10년 전 | 1442 | ||
| 7707 | 10년 전 | 836 | ||
| 7706 |
별지기천사
|
10년 전 | 550 | |
| 7705 | 10년 전 | 1051 | ||
| 7704 |
ICONdesignstudio
|
10년 전 | 595 | |
| 7703 | 10년 전 | 564 | ||
| 7702 |
|
10년 전 | 691 | |
| 7701 | 10년 전 | 1391 | ||
| 7700 | 10년 전 | 1085 | ||
| 7699 | 10년 전 | 563 | ||
| 7698 | 10년 전 | 1116 | ||
| 7697 | 10년 전 | 5122 | ||
| 7696 | 10년 전 | 619 | ||
| 7695 | 10년 전 | 1659 | ||
| 7694 | 10년 전 | 1026 | ||
| 7693 | 10년 전 | 1523 | ||
| 7692 | 10년 전 | 1257 | ||
| 7691 | 10년 전 | 791 | ||
| 7690 | 10년 전 | 1371 | ||
| 7689 | 10년 전 | 989 | ||
| 7688 | 10년 전 | 582 | ||
| 7687 |
파랑새1597
|
10년 전 | 561 | |
| 7686 | 10년 전 | 807 | ||
| 7685 | 10년 전 | 1329 | ||
| 7684 | 10년 전 | 776 | ||
| 7683 | 10년 전 | 1030 | ||
| 7682 | 10년 전 | 940 | ||
| 7681 | 10년 전 | 628 | ||
| 7680 | 10년 전 | 972 | ||
| 7679 | 10년 전 | 470 | ||
| 7678 | 10년 전 | 702 | ||
| 7677 | 10년 전 | 601 | ||
| 7676 |
|
10년 전 | 923 | |
| 7675 |
|
10년 전 | 1126 | |
| 7674 | 10년 전 | 1031 | ||
| 7673 | 10년 전 | 732 | ||
| 7672 | 10년 전 | 1068 | ||
| 7671 | 10년 전 | 855 | ||
| 7670 | 10년 전 | 621 | ||
| 7669 |
mashmellow
|
10년 전 | 1210 | |
| 7668 | 10년 전 | 691 | ||
| 7667 | 10년 전 | 968 | ||
| 7666 |
senseme
|
10년 전 | 630 | |
| 7665 | 10년 전 | 483 | ||
| 7664 | 10년 전 | 1876 | ||
| 7663 |
mixx애교
|
10년 전 | 962 | |
| 7662 | 10년 전 | 1012 | ||
| 7661 |
hkhkah
|
10년 전 | 770 | |
| 7660 | 10년 전 | 1044 | ||
| 7659 |
커네드커네드
|
10년 전 | 910 | |
| 7658 |
바람돌이팡
|
10년 전 | 643 | |
| 7657 | 10년 전 | 1148 | ||
| 7656 | 10년 전 | 1546 | ||
| 7655 | 10년 전 | 957 | ||
| 7654 |
개발짜증나
|
10년 전 | 843 | |
| 7653 |
네이비칼라
|
10년 전 | 873 | |
| 7652 |
밥먹고합시다
|
10년 전 | 794 | |
| 7651 |
플라이SINJI
|
10년 전 | 1494 | |
| 7650 |
개발짜증나
|
10년 전 | 1390 | |
| 7649 | 10년 전 | 435 | ||
| 7648 |
이미영ㅇㅇ
|
10년 전 | 848 | |
| 7647 | 10년 전 | 414 | ||
| 7646 | 10년 전 | 778 | ||
| 7645 | 10년 전 | 2281 | ||
| 7644 | 10년 전 | 796 | ||
| 7643 |
|
10년 전 | 2848 | |
| 7642 | 10년 전 | 1494 | ||
| 7641 | 10년 전 | 1112 | ||
| 7640 |
개발짜증나
|
10년 전 | 458 | |
| 7639 |
|
10년 전 | 797 | |
| 7638 |
개발짜증나
|
10년 전 | 1109 | |
| 7637 | 10년 전 | 1526 | ||
| 7636 | 10년 전 | 2887 | ||
| 7635 | 10년 전 | 1670 | ||
| 7634 | 10년 전 | 1838 | ||
| 7633 | 10년 전 | 2306 | ||
| 7632 | 10년 전 | 3906 | ||
| 7631 |
|
10년 전 | 1513 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기