我如何编写一个javascipt,在提交时,会检查两个字段是否为空,如果它们不是空白,那么它会自动将另一个字段设置为“TRUE”?示例:
发票表 - 顾客ID, InvoiceID, 校验, 现金#, 支付
我希望该函数检查现金或支票#中是否有任何值,然后选中付费复选框。
答案 0 :(得分:0)
<input type=submit onclick='var a=document.getElementById("cash"); if(a && a.value != ""){document.getElementById("paid").selected = true;}; return true;'>
可能需要对此进行一些语法检查。