Form 提交表 单页面刷新不跳转

方法一:

1.提交form,action 提交数据,但页面不跳转,可以使用Iframe简单方法

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type"content="text/html; charset=utf-8"/>
<title>Form提交表单页面不跳转</title>
</head>
<body>
<form action="hello.php"method="post"target="id_iframe">
<input type="text"id="input_text"name="input_text"/>
<input type="submit"id="sobmit"name="submit"value="提交"/>
</form>
<iframe id="id_iframe"name="id_iframe"style=""></iframe><!--hello.php页面返回的数据 显示在iframe 中->
</body>
</html>

 

2.注意1 <form action="hello.php"method="post"target="id_iframe"></from>中的target 一定是你要指定要显示返回结果的 <iframe id="id_iframe"name="id_iframe"style=""></iframe> 标签中的name属性

3.注意2 <iframe id="id_iframe"name="id_iframe"style=""></iframe> 可以放到body中的任何位置 特别注意可以放到 <form action="hello.php"method="post"target="id_iframe"></from> 中

转载于:https://www.cnblogs.com/shangbolei/p/4424603.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值