javascript空白验证还是不行
这是个餐馆网站,菜单可以选点的菜的数量,然后放进购物车里面。
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> while(...){ echo "<form name='shopping_cart_form' method='post' action='include/shopping_cart_form.php' onsubmit='return dosubmit();'>"; echo "<div id='item_details' style=''> <div id='item_label'> <div id='dish_price'> <a style='font-size:30pt; margin-top:20px; float:left;'>\$</a> <a style='font-size:50pt; margin-top:40px; float:left;'>$prices[0]</a> <a style='font-size:10pt; margin-top:40px; float:left;'>.</a> <a style='font-size:20pt; margin-top:30px; float:left;'>$prices[1]</a> </div> <div id='dish_img'><img src='css_and_img/$dish_img' style='width: 320px; height:160px; border:none' border=none></div> </div> <div id='item_info'> <div id='dish_name'>$dish_name</div> <div id='dish_descr'>Description: $dish_descr</div> <div id='add_to_function'> Qty: <input class='txt_qty' type='text' name='textbox_qty' id='textbox_qty' /> <input class='add_button' type='submit' name='btn_add' id='btn_add' value='Add to Cart' /> <input type='hidden' name='shopID' value='$shop_id'> <input type='hidden' name='destID' value='$dest_id'> <input type='hidden' name='catID' value='$cat_id'> <input type='hidden' name='dishID' value='$dish_id'> <input type='hidden' name='dishName' value='$dish_name'> <input type='hidden' name='dishPrice' value='$dish_price'> </div> </div> </div>"; echo "</br>"; echo "</form>"; }
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>