首页  >  文章  >  web前端  >  html 表单点提交没反应?_html/css_WEB-ITnose

html 表单点提交没反应?_html/css_WEB-ITnose

WBOY
WBOY原创
2016-06-24 12:11:291167浏览

这是我用dreamweaver做的!程序如下:



无标题文档
<script> <br /> function bdtj() <br /> { <br /> if(document.bd.yhm.value.length===0) <br /> {alert("用户名未输入!!!!") <br /> bd.yhm.focus(); <br /> return; <br /> } <br /> document.bd.button() <br /> } <br /> </script>



  
    
      
      
      
    
    
      
      
      
    
    
      
      
      
    
  
姓名:
      
 
性别:


        
        

      

 
 





点击提交后怎么没有跳转到cl.html网页


回复讨论(解决方案)

document.getElementById("bd").submit()

<html><head><title>无标题文档</title><script type="text/javascript">function bdtj(){ if(document.bd.yhm.value.length===0){alert("用户名未输入!!!!")  bd.yhm.focus();  return; } document.bd.submit() }</script></head><body><form id="bd" name="bd" method="post" action="cl.html">  <table width="266" height="239" border="1">  <tr>  <td width="48">姓名:</td>  <td width="105"><label for="yhm"></label>  <input name="yhm" type="text" id="yhm" size="15" /></td>  <td width="91"> </td>  </tr>  <tr>  <td>性别:</td>  <td><p>  <label>  <input type="radio" name="RadioGroup1" value="1" id="RadioGroup1_0" />  男</label>  <label>  <input type="radio" name="RadioGroup1" value="2" id="RadioGroup1_1" />  女</label>  </p></td>  <td> </td>  </tr>  <tr>  <td><input name="button" type="button" id="button" onClick="bdtj();" value="提交" /></td>  <td> </td>  <td><input type="button" name="button2" id="button2" value="取消" /></td>  </tr>  </table></form></body></html>



楼主 试试

HTML code

document.getElementById("bd").submit()
.submit是什么意思.button可以吗

触发 form提交就是 submit 而不是 button

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn