Home > Backend Development > PHP Tutorial > javascript空白验证还是不行解决方案

javascript空白验证还是不行解决方案

WBOY
Release: 2016-06-13 10:20:53
Original
773 people have browsed it

javascript空白验证还是不行
这是个餐馆网站,菜单可以选点的菜的数量,然后放进购物车里面。

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->while(...){echo "
Copy after login
"; echo "
$dish_name
Description: $dish_descr
  Qty:
"; echo ""; echo "
";}

之前发的帖子问了,但是我问错了,form是在循环里面,所以不能用getElementById来判断。在此感谢一下T5500对我帮助。
每个form里面只有一个input type=text 现在就是在每个form提交之前,怎么判断每个text不能为空或者为0 ??


------解决方案--------------------
onsubmit='return dosubmit();'
改为
onsubmit='return dosubmit(this);'

js
JScript code
function dosubmit(fmt) {  if(fmt.textbox_qty.value == '') {    fmt.textbox_qty.focus();    alert('不能为空');    return false;  }  return true;}<br><font color="#e78608">------解决方案--------------------</font><br>function isEmpty()<br>{<br>   function isEmpty() {<br>这里看到函数命名两次。是手误还是什么?<div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template