Textarea tự động tăng kích thước 2007-07-26 01:07:02
Gửi TG demo:
<?
<html>
<body>
<div id="alert" style="background-color: #CCC"></div>
<center>
<form name="doc">
<textarea name="tx" onkeyup="mOnKup();" wrap="physical" style="height:100;overflow:auto">
thu nghiem ve tu dong tang kich thuoc
</textarea>
</form>
</center>
</body>
<script type="text/javascript">
function mOnKup(){
var oHeight = document.doc.tx.scrollHeight;
var cHeight = document.doc.tx.clientHeight;
if (cHeight+10 < oHeight) {
document.doc.tx.style.height = oHeight+2+ "px";
document.doc.tx.value += cHeight + " : " + oHeight;
}
}
</script>
</html>
?>
Tra loi 7 comment(s) 2007-07-26 01:07:02
TG 2007-07-26 05:09:21
Tra loi
SAD 2008-07-06 12:35:59
if (cHeight < oHeight) {...
chạy cũng ok mà, đâu cần +10
Tra loi
gaulucky92 2008-07-06 06:02:55
Tra loi
choncon 2008-09-11 09:00:57
Tra loi
Về Đâu 2008-09-18 03:07:39
Tra loi
deverlop extjs 2009-03-10 12:05:16
Tra loi
Ken Phan 2009-03-10 09:11:18
Tra loi
Y kien