<script language="javascript" type="text/javascript">
function check()
{
namevalue=document.theform.name.value;
if(namevalue!=null && namevalue!='')
{
alert('not null');
return true;
}
else
{
alert('null');
return flase;
}
}
</script>
function check()
{
namevalue=document.theform.name.value;
if(namevalue!=null && namevalue!='')
{
alert('not null');
return true;
}
else
{
alert('null');
return flase;
}
}
</script>
解决方案 »
- 【急】利用xsd校验xml格式问题
- struts2 Action返回List返回空...
- Could not load mediaLib accelerator wrapper classes.
- struts中<c:if test=""> 标签的问题。
- 请问为什么我用eclipse建项目自动生成的web.xml文件都有叉啊?
- 有Herbinate的查询,分页,更新的例子吗?
- microsoft IIS与tomcat可否并存?
- 装了tomcat(端口是8080)后发现原来的resion(端口是8090)不能用了
- 新手求助--weblogic入门小问题--怎样知道建立一个JDBC Connection Pool已经成功??
- 配置data source
- 快崩溃了,一个servlet问题
- 金山毒霸与tomcat会起冲突吗?
function check()
{
namevalue=document.theform.name.value;
if(namevalue!=null && namevalue.length>0)
{
alert('not null');
return true;
}
else
{
alert('null');
return flase;
}
}
</script>
<head> <title>a </title>
<script language="javascript" type="text/javascript">
function check()
{
var namevalue=document.theform.name.value;
if(namevalue!="")
{
alert('not null');
return true;
}
else
{
alert('null');
return flase;
}
}
</script> </head>
<body>
<form name="theform" >
<input type="text" name="name" size="10" value="">
<input type="submit" onclick="check();">
</form>
</body>
</html>
测试可以用,呵呵,谢谢楼主看看吧,应该没有问题,多细心点就可以了
你的
if(namevalue!=null)
{
alert('not null');
return true;
}
这个判断有问题~!namevalue != null这种判断是错误的,
改成namevalue != "" 或者改成 namevalue.length > 0 就可以了
这个改成 if(namevalue!="")
function check()
{
namevalue=document.theform.name.value;
if(namevalue=='')
{
alert(' null');
return false;
}
else
{
alert('not null');
}
}
</script>