想文本域高度可以设置,不知道怎么弄好,js 应该没有错误 望大家看看
<textarea rows="30" cols="70" id="content" name="detailval">abcdefg</textarea>
function addRows(){
var status=document.getElementById("content").rows;
document.getElementById("content").rows=status+10;
alert(document.getElementById("content").rows);
}
function deleteRows(){
var status=document.getElementById("content").rows;
document.getElementById("content").rows=status-10;
alert(document.getElementById("content").rows);
}
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base />
<script src="http://code.jquery.com/jquery-latest.js"></script><script>
var currentHeight = 50;
onload = function () {
$("#btnAdd").click(function () {
addRows();
});
$("#btnDel").click(function () {
deleteRows();
});
$("#content").css("height", currentHeight + "px");
$("#content").css("width", "300px");
}
function addRows() {
currentHeight += 10;
$("#content").css("height",currentHeight + "px");
}function deleteRows() {
currentHeight += -10;
$("#content").css("height", currentHeight + "px");
}
</script>
</head>
<body>
<textarea id="content" name="detailval">abcdefg</textarea>
<button id="btnAdd">高</button>
<button id="btnDel">矮</button>
</body>
</html>
document.getElementById("content").setAttribute("rows","80");
<head> </head>
<body>
<div><textarea cols = "10" rows = "20">
fafdaf </textarea></div>
</body>
</html>