admin管理员组文章数量:1391798
I have form and some fields and I want send these fields to the next page via done.php
using action="#main_body"
.
What are the differences between these two forms?
<form id="formElem" name="formElem" action="/ifs/form/index.php" method="post">
<form id="formElem " class="ifs" method="post" action="#main_body">
I have form and some fields and I want send these fields to the next page via done.php
using action="#main_body"
.
What are the differences between these two forms?
<form id="formElem" name="formElem" action="/ifs/form/index.php" method="post">
<form id="formElem " class="ifs" method="post" action="#main_body">
Share
Improve this question
edited Aug 1, 2012 at 8:00
hakre
198k55 gold badges449 silver badges856 bronze badges
asked Jan 2, 2012 at 10:19
user1122910user1122910
1173 silver badges15 bronze badges
1
-
Unless your form is part of done.php, use
action="path/to/done.php"
. – Herbert Commented Jan 2, 2012 at 10:34
3 Answers
Reset to default 6The plete action of the form is the URL of the page containing the form at the time of loading the form + the hashtag. So submitting the form will load the same page, but with a ahashtag (anchor) of #man_body. This is a side effect of action attributes being realtive if not definitly given as absolute.
Please be aware, that it is browser-dependant and header-dependant wether the page will actually reload or just scroll.
in the first case you send the values of your inputs to a specific page called done.php. In the second way you're calling the same page in which you have your form (plus an hashtag)
In the second link you are calling the same page with a hashtag of "main_body". it will work something like a 'TOP' link provided in lengthy pages which scrolled back to top of the page. a difference is here the page will scroll(or reload) to "main_body" when you submit the form.
本文标签: phpwhat is meant by actionquotmainbodyquot in a HTML formStack Overflow
版权声明:本文标题:php - what is meant by action="#main_body" in a HTML form - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744680857a2619398.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论