JS判断不能为空实例代码。分享在此。

代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8">
<title>短信系统 - www.jbxue.com </title>
<script language="javascript">
function formcheck(){
if(document.form.zhanghao.value==""){
alert("号码不能为空!");
this.form1.zhanghao.focus();
return false;
}else if(document.form.email.value==""){
alert("内容不能为空!")
this.form1.eamil.focus();
return false;
}else form1.submit();
}
</script>
</head>

<body>
<form name="form" method="post" action="sendmail.php" class="formg">
<table>
<h2>
<tr>
<th colspan="8" class="CTitle">发送短信</th>
</tr>
</h2>

<body>

<tr bgcolor="#eeeeee">
<td align="center">号 码:</td>
<td><textarea name="content" cols="80" rows="15" id="zhanghao" class="formh"></textarea></td>
</tr>
<tr bgcolor="#eeeeee">
<td align="center">内 容:</td>
<td><textarea name="content" cols="80" rows="15" id="email" class="formh"></textarea></td>
</tr>

<tr bgcolor="#eeeeee" align="center">
<td height="25" colspan="2">
<input type="button" name="Submit" value="发 送" class="button" onClick="javascript:formcheck();">
<input type="reset" name="Submit2" value="重 置" class="button">
</td>
</tr>
</body>
</table>
</form>
</body>
</html>

JS判断不能为空实例代码的更多相关文章

  1. js判断是否为空的代码

    方法一: var keyVal= $("#key").val(); if(keyVal==undefined || keyVal=="" || keyVal== ...

  2. js判断是否为空火undefined是否给undefined加引号

    js判断是否为空为undefined如果判断的是类型则用typeof(),如果其本身就是“undefind”字符窜,则不能这样判断, 这样typeof之后是字符串类型就判断不出来了,这是需要去掉typ ...

  3. BootStrap fileinput.js文件上传组件实例代码

    1.首先我们下载好fileinput插件引入插件 ? 1 2 3 <span style="font-size:14px;"><link type="t ...

  4. js判断是否为空和typeof的用法

    (1)typeof作用用于查看数据类型 (2)typeof用法typeof 返回值类型有number, string, boolean, function, undefined, objectPS:在 ...

  5. js的dom测试及实例代码

    js的dom测试及实例代码 一.总结 一句话总结: 1.需要记得 创建 标签和创建文本节点都是document的活:document.createTextNode("Rockets的姚明&q ...

  6. JS判断内容为空方法总结

    HTML代码: 用户名:<input type="text" id="username"> <p style="color:red& ...

  7. js判断是否为空

    http://dushanggaolou.iteye.com/blog/1293803 1.<input type="hidden" id="key" n ...

  8. js左侧三级菜单导航实例代码

    在左侧三级菜单导航想必大家都见到过吧,它的实现过程也并不复杂,下面有个不错的示例,感兴趣的朋友可以了解下 实例代码:   <!DOCTYPE html PUBLIC "-//W3C// ...

  9. js 判断是否是空对象

    主要思路 我们要考虑到的主要有:js原生对象,宿主对象(浏览器上面的). 首先对于宿主对象 主要判断是DOM 对象 和是否是window 对象 是否是DOM对象  value.nodeType 是否存 ...

随机推荐

  1. android-------非常好的图片加载框架和缓存库(Picasso)

    Picasso是Square公司开源的一个Android图形缓存库, 可以实现图片加载(本地和网络)和缓存功能. 地址:http://square.github.io/picasso/ jar包下载: ...

  2. VS2019/VS2017安装源离线下载,更新,清理,企业版与论坛版重复下载

    VS2019 安装器下载 https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel ...

  3. do-while语句和while的区别

    do-while语句是一种后测试循环语句,即只有在循环体中的代码执行之后,才会测试出口条件.其实就是,代码在刚开始执行的时候,都是要先走一遍do循环体内的代码,然后在与while里面的条件进行判断,成 ...

  4. Spartan6上软核系统自定义外设调用AXI Stream FFT经验

    这几天希望能在Spartan系列新品xc6slx16csg324-2运行带有FFT的软核处理系统,基本系统早就搭建好了.需要做的就是建立一个封装有Xilinx提供的FFT IP的自定义外设.由于Xil ...

  5. w3m使用小记

    By francis_hao    Mar 8,2017   w3m是一个基于文本的web浏览器和分页器,运行在unix和windows系统上. 可显示包含链接的超文本标记语言(HTML),显示效果如 ...

  6. C#统计给定的文本中字符出现的次数,使用循环和递归两种方法

    前几天看了一个.net程序员面试题目,题目是”统计给定的文本中字符出现的次数,使用循环和递归两种方法“. 下面是我对这个题目的解法: 1.使用循环: /// <summary> /// 使 ...

  7. CF1076E:Vasya and a Tree(DFS&差分)

    Vasya has a tree consisting of n n vertices with root in vertex 1 1 . At first all vertices has 0 0 ...

  8. 开发中PG,PL,SE,PM都是什么意思

    注:参考连接:http://blog.csdn.net/ahutqi/article/details/42104361 项目最顶层是项目负责人,接下来项目会落实到pm(项目经理PM),项目经理将任务分 ...

  9. 转 GraphQL Schema Stitching explained: Schema Delegation

    转自官方文档 In the last article, we discussed the ins and outs of remote (executable) schemas. These remo ...

  10. bitmapdata的知识点

    flashplayer的cpu渲染 bitmapData占用的内存分两块,一块是原始数据区,另一块是解压后的内存区10秒内如果没有使用这个bitmapdata,解压后的内存区会被释放,当10秒后重新使 ...