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

来源:互联网 发布:it技术学校 编辑:程序博客网 时间:2024/06/15 08:55
提交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>
1.注意1 <form action="hello.php"method="post"target="id_iframe"></from>中的target 一定是你要指定要显示返回结果的 <iframe id="id_iframe"name="id_iframe"style=""></iframe> 标签中的name属性
2.<iframe id="id_iframe"name="id_iframe"style=""></iframe> 可以放到body中的任何位置 特别注意可以放到 <form action="hello.php"method="post"target="id_iframe"></from> 
0 0
原创粉丝点击