关于form表单无刷新提交上传

来源:互联网 发布:js cookie 自动登录 编辑:程序博客网 时间:2024/05/17 02:49
1)在当前页面建一个iframe 并隐藏(display:none).
2)新建的这个iframe起个名字,例如:disIframe
3form表单的target属性设为刚起的这个名字disIframe
4)提交表单。就是无刷新了。
别的一些效果就靠自己了。想让页面看起来的好看,可以在提交的时候出现一个等待的图标,结束后,再把图标隐藏。

<</span>iframe name="dis" style="display:none"></</span>iframe>

<</span>form action="/UestcApp/AdminUserAction.do"method="post" target="dis">

   <</span>input type="text" name="myInput"></</span>input>

   <</span>input type="password"></</span>input>

   <</span>input type="submit"></</span>input> 

</</span>form>

0 0