JS如何判断textarea的内容长度 你的这些写在了哪里?试试 if (document.add.a59.value.length<100){alert("不能少于100字!");add.a59.focus();return false;} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>New Page 2</title></head><body><textarea ></textarea><input type=button value=check onclick="checkMaxLength(this.previousSibling,20)"</body></html><script>/***checkMaxLength.*JK 2006-11-26*/function checkMaxLength(textareaObj,maxLength){ if(maxLength == null) maxLength=textareaObj.getAttribute("maxLength"); if(maxLength == null) maxLength=1024; var currentLength = textareaObj.value.length; if (currentLength > maxLength) { alert("The length of your input ("+currentLength+") is larger than the maxLength ("+maxLength+") ."); if(textareaObj.createTextRange){ var textRange=textareaObj.createTextRange(); textRange.moveStart('character',10); textRange.select(); } else textareaObj.select(); textareaObj.focus(); return false; } return true;}</script> textRange.moveStart('character',10);-->>> textRange.moveStart('character',maxLength); java,.net,asp,hacker技术讨论群14401742,诚招高手加入,共同讨论,共同发展。 请给个jquery的 放大图片的代码 javascript 的代码问题 FF 获取自定义标签的问题请教 请问如何在javascript中设置html打印页面的页边距? select元素,取值问题??? <select>筐中必须选一个<option>,javascript验证怎么写? 小弟出学正则表达式,请指教 window.showModalDialog这个函数只有ie5.5以上才有吗? 急待解决问题:看看下面是什么原因出错?? 请问有经验的大哥们,现在手机web开发,你们都在用什么框架 关于才能弹出保存文件的对话框,就是右键另存为那种 在javascript中如何给文本框赋值??
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>New Page 2</title>
</head><body>
<textarea ></textarea><input type=button value=check onclick="checkMaxLength(this.previousSibling,20)"
</body></html>
<script>
/**
*checkMaxLength.
*JK 2006-11-26
*/
function checkMaxLength(textareaObj,maxLength)
{
if(maxLength == null) maxLength=textareaObj.getAttribute("maxLength");
if(maxLength == null) maxLength=1024;
var currentLength = textareaObj.value.length;
if (currentLength > maxLength) {
alert("The length of your input ("+currentLength+") is larger than the maxLength ("+maxLength+") .");
if(textareaObj.createTextRange){
var textRange=textareaObj.createTextRange();
textRange.moveStart('character',10);
textRange.select();
}
else textareaObj.select();
textareaObj.focus();
return false;
}
return true;
}
</script>
-->>>
textRange.moveStart('character',maxLength);