자동으로 textarea 크기 조절하기 정보
JavaScript 자동으로 textarea 크기 조절하기본문
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</head>
<body>
<textarea name="textarea" scol cols="50" rows="5" onKeyDown="setLine( this )"></textarea>
<script language="javascript">
function setLine( txa ){
line = 5 //기본 줄 수
new_line = txa.value.split( "\n" ).length + 1;
if( new_line < line ) new_line = line;
txa.rows = new_line;
}
</script>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</head>
<body>
<textarea name="textarea" scol cols="50" rows="5" onKeyDown="setLine( this )"></textarea>
<script language="javascript">
function setLine( txa ){
line = 5 //기본 줄 수
new_line = txa.value.split( "\n" ).length + 1;
if( new_line < line ) new_line = line;
txa.rows = new_line;
}
</script>
</body>
</html>
추천
0
0
댓글 3개
감사요~
감사요~
감사합니다.