日期:2014-05-17 浏览次数:20868 次
<html>
<head>
<title>测试专用页
</title>
</head>
<body>
<form method=post name=ceshi action="index.htm">
<textarea name=textarea1 onpropertychange=checkMaxLen(this,20,0)></textarea>
</form>
</body>
<html>
<script language=javascript>
var oldValue=new Array();
function checkMaxLen(obj,maxlength,num){
if(obj.value.length>maxlength){
obj.value=oldValue[num];
}
else{
oldValue[num]=obj.value;
}
}
</script>
------解决方案--------------------
总体思路就是使用js做check和控制。
------解决方案--------------------
http://www.it560.com/design/htmlcss/
有详细介绍,希望对你有帮助
------解决方案--------------------
直接设置不是更方便吗?干嘛非要使用JS来判断啊?
------解决方案--------------------
1)textarea标签是成对出现的,以<textarea>开始,以</textarea>结束
属性:
Common -- 一般属性
cols -- 多行输入域的列数
rows -- 多行输入域的行数
alt -- 代表表单的提示文字,当鼠标停留时
accesskey -- 表单的快捷键访问方式
disabled -- 输入域无法获得焦点,无法选择,以灰色显示,在表单中不起任何作用
readonly -- 输入域可以选择,但是无法修改
tabindex -- 输入域,使用"tab"键的遍历顺序
<textarea cols=“ 你要的多少字”> </textarea>
------解决方案--------------------
<textarea onkeypress="正则表达式"> </textarea>