<script language="javascript"> function checklogin() { if (document.getElementById("TblUserMenu")==null){ alert("你还没有登录,请登录后再提交购物清单。"); return false; }else{ return true; } } </script> . . . . <tr> <td align="center" colspan="5"><input type="submit" value="生成订单" name="cartBtn" onclick="javascript:return(checklogin());"></td> <td align="center"><input type="submit" value="清空购物车" name="cartBtn"></td> </tr>
解决方法:
Myeclipse 10.0之前都不会出现这种问题,window -->preferences -->myeclipse -->validation -->javascript validator for Js files 把Bulid 复选框的勾去掉。