当前位置:神舟问>百科知识>html 表单提交

html 表单提交

2024-03-30 07:53:17 编辑:join 浏览量:566

问题补充说明:想创建一个表单用POST方法提交到servlet处理,可是提交之前想用javascript来检验一下还有没有空白栏没填,怎么实现呢?我只会直接提交到servlet不会之前用js检验,求指导!

html 表单提交

1234古灯56789101112131415161718<form action="servlet.php" enctype="multipart/form-data" method="post" onsubmit="return Topliuyan()"> 姓名:<input type="text" id="top_name" />   手北失机号码:<input typ今进将作e="text" id="top_phone"/>    <input type="submit" value="提交"/>    </360问答form>   <script type="text/javascript"> function Topliuyan(){    var top_name=document.getElementById("top_name").value;    var top_phone=document.getElementById("top_phone").value;    if(top_na凯乙据行绍事界四干紧斯me.length==0)歌验大头鸡组动向{        aler响经唱t("姓名不能为与假心婷空!!!");        r部派eturn fal名阶身座思少金将子老se;    }else if(top_phone.length==0){        alert("请输入电话!!!");        return false;    }}</script>

标签:html,表单,提交

版权声明:文章由 神舟问 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.shenzhouwen.com/article/313140.html
热门文章