小弟今天遇到一个问题,用javascript在客户端判断form中的textarea的内容是否为空。
部分代码如下,但不知为什么不能运行,上网找了些资料试了下也不行。请各位高手帮忙看看。
谢谢了。
<html>
<form id=xx name=xx action= "xx " onsubmit= "return checkinput(); ">
<textarea name=xx id=xx cols=xx > </textarea>
<html>
<script type= "text/javascript ">
function checkinput()
{
if (document.all.formname.textareaname.value== " ")
{
window.alert( '不能输入空值 ');
document.all.formname.textareaname.foucs();
return false;
}
return true;
}
部分代码如下,但不知为什么不能运行,上网找了些资料试了下也不行。请各位高手帮忙看看。
谢谢了。
<html>
<form id=xx name=xx action= "xx " onsubmit= "return checkinput(); ">
<textarea name=xx id=xx cols=xx > </textarea>
<html>
<script type= "text/javascript ">
function checkinput()
{
if (document.all.formname.textareaname.value== " ")
{
window.alert( '不能输入空值 ');
document.all.formname.textareaname.foucs();
return false;
}
return true;
}
document.formName.textareaName.value=="")
var nm=document.getElementById("控件ID");if(nm.value.length<=0)
{
alert("概要名称入力してください!");
nm.focus();
}
if(document.getElementById("xx").innerText == "")
{
alert("xx.value is ''");
}
{
//为空
}