admin管理员组

文章数量:1573363

在实际应用中,可能有这样的需要,那就是提交表单之后,要求以某一种方式打开接收数据的页面。

下面就通过代码实例做一下简单介绍。

代码如下:

 
  
   
    
    
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 <!DOCTYPE html> < html > < head > < meta charset = "utf-8" > < meta name = "author" content = "http://www.softwhy/" /> < title >蚂蚁部落</ title > < script type = "text/javascript" > function sub() {    document.forms[0].elements[0].disabled = true;    document.forms[0].submit(); } window.onload=function(){    var obt=document.getElementById("bt");    obt.onclick=function(){      sub();    } } </ script > </ head > < body > < form action = "login.action" target = "_blank" method = "post" >    < input type = "button" name = "btn" id = "bt" value = "提交表单" /> </ form > </ body > </ html >

上面的代码实现了我们的要求,可以在一个新的空白页面打开接收数据的页面。

实现方式就是使用form元素的target属性规定,非常的简单,类似于链接a的target属性。



原文发布时间为:2017-2-25

本文作者:admin

本文来自云栖社区合作伙伴“蚂蚁部落”,了解相关信息可以关注蚂蚁部落

原文链接:规定form表单提交的页面打开方式


本文标签: 表单页面方式Form