>  기사  >  웹 프론트엔드  >  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으로 문의하세요.