如何用javascript判断某个字段值是否为空值? var a;typeof( a) == 'undefined' || a == null 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 谢谢楼上的!我晕了,作论坛时为了在某字段值为null时,用其它的字符输出,而不是输出成null如 rs 是记录集,要测试的字段是rs(3),我这样测试if(rs(3)==null) Response.Write("空值");本来在其它语句中用 rs(3),就取得了该字段的值了,可是用上面的语句测试就是不行,整了我很久,最后我改成这样if(rs(3).value==null) Response.Write("空值");嘿,它就可以用了,不懂是何道理. Response.Write不是ASP的吗?JS也有吗? <script>function CheckForm(){ for(iIndex=0;iIndex<document.forms[0].elements.length;iIndex++) { if(document.forms[0].item(iIndex).tagName=="INPUT") { if(document.forms[0].item(iIndex).type=="text") { if(document.forms[0].item(iIndex).value=="") { return false; } } } } return true;}</script><form><input type=text id="T1" value=""><input type=text id="T2" value=""><input type=text id="T3" value=""><br><input type=button id="B1" value="效验" onclick="if(!CheckForm()){window.confirm('存在NULL')}"></form> 你的代碼是ASP的﹐怎么問的是JAVASCRIPT的問題? <html><head><script>function IsNull(){ if(event.srcElement.value.length==0) { alert("null is forbidden!"); //alert(event.srcElement.id+" is checking"); event.srcElement.focus(); alert("OK") } return;}</script></head><body><input type="text" name="s1" id="s1" onfocus="IsNull()"><input type="text" name="s2" id="s2" onfocus="IsNull()"></body></html>这是你要的代码? zDialog在ie7,ie8下显示不正常 求救!在线等!各位高手,如何使用走马灯显示数据 一个简单的js定时切换选项卡问题 急问小问题:js正则中是否有类似Perl的$1? JSP 网页中如何去掉radio每个选项前的那个小圆圈 请教个定义函数对象的问题 js 动态创建json 树形结构问题(要在表单中呈现) 在IE11下使用 HTML5 API 的拖拽,尼玛当时我就震惊了! JS美化,生活查询,万年历,二维码生成等 求助!!!!能实现以下的功能吗??急 如何给表单增加行
我晕了,作论坛时为了在某字段值为null时,用其它的字符输出,而不是输出成null
如 rs 是记录集,要测试的字段是rs(3),
我这样测试
if(rs(3)==null) Response.Write("空值");
本来在其它语句中用 rs(3),就取得了该字段的值了,可是用上面的语句测试就是不行,整了我很久,最后我改成这样
if(rs(3).value==null) Response.Write("空值");
嘿,它就可以用了,不懂是何道理.
function CheckForm()
{
for(iIndex=0;iIndex<document.forms[0].elements.length;iIndex++)
{
if(document.forms[0].item(iIndex).tagName=="INPUT")
{
if(document.forms[0].item(iIndex).type=="text")
{
if(document.forms[0].item(iIndex).value=="")
{
return false;
}
}
}
}
return true;
}
</script>
<form>
<input type=text id="T1" value="">
<input type=text id="T2" value="">
<input type=text id="T3" value="">
<br>
<input type=button id="B1" value="效验" onclick="if(!CheckForm()){window.confirm('存在NULL')}">
</form>
<head>
<script>
function IsNull()
{
if(event.srcElement.value.length==0)
{
alert("null is forbidden!");
//alert(event.srcElement.id+" is checking");
event.srcElement.focus();
alert("OK")
}
return;
}
</script>
</head>
<body>
<input type="text" name="s1" id="s1" onfocus="IsNull()">
<input type="text" name="s2" id="s2" onfocus="IsNull()">
</body>
</html>
这是你要的代码?