三个值是从数据库读出来,不让他为空就Ok
代码:
不知道你想问什么
当不选中其一时,提交不成功?
在form 的onsubmit 事件中调用js函数验证就是了
参考一下
<script>function foo(){ var chs=document.getElementsByName('app_types[]'); var counter=0; for(var i=0;i<chs.length;i++){ if(chs[i].checked) counter++; } if(counter==0) return false; return true;}</script><form action="" method="post" onsubmit="return foo()"><input id="app" name="app_types[]" type="checkbox" value="1"><input id="app" name="app_types[]" type="checkbox" value="2"><input id="app" name="app_types[]" type="checkbox" value="3"><input type='submit'></form>谢谢了,稍做了一下逻辑就搞定了
谢谢了,高手们
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号