在实际应用中,可能有这样的需要,那就是提交表单之后,要求以某一种方式打开接收数据的页面。admin管理员组文章数量:1573361
下面就通过代码实例做一下简单介绍。
代码如下:
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表单提交的页面打开方式 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1727747204a1127946.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论