【问题标题】:HTML form onsubmit = null but sends me to a pageHTML 表单 onsubmit = null 但将我发送到一个页面
【发布时间】:2013-11-05 02:06:21
【问题描述】:

所以我想弄清楚当我提交此表单时是什么将我带到了另一个页面。 frmS.onsubmit = null。此外,提交按钮没有将您发送到另一个页面的点击。我想了解它是如何将我转到其他页面以及如何阻止它的。 编辑:我应该补充一点,我希望它发送它发送的信息,但不要把我扔到下一页。

EDIT2:已解决我制作了一个 iframe 并将表单目标设置为该 iframe。谢谢保罗德雷珀

<form name="frmS" method="post" action="/s.aspx?sm=1jFsQEImT6d7s5gJzLre0g%3d%3d" id="frmS">
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWDwL+raDpAgLOhOEnAqrszZoKAsv4g6IHAqDo8XkCqc7S2wcC96SjuQgC+beo3gUCi5yS5QgCsOmqpAECjce8xA0C0I38vQkCnNGksA4Cw/alsQoC1J6ZlwQMnZiKw/euXyNaAEgF3qFMFg5vlA==">
<input type="hidden" name="__VIEWSTATE" id="
__VIEWSTATE" value="">

</div>

<!--content area-->

<div id="PageContentDiv"><div style="text-align:left;"><div class="sLogo"><img class="notranslate" src="http://secure.surveymonkey.com/_resources/4485/45604485/552bd2d8-f3b6-4e1f-b1e5-3c5ea48189b9.gif" alt=""><div class="sExit"><a class="ExitBtn" target="_self" href="http://www.gazette.net/teacher">Exit this survey</a>&nbsp;</div><br class="clear"></div></div><h1 class="sTitle"><div style="text-align:left;float:none;"><span class="notranslate">My Favorite Teacher 2013 - Montgomery County High School</span></div></h1><div class="pTitle"><h2>2. </h2>&nbsp;<br class="clear"></div><div class="pgHdr"><div id="q1" class="question" style="margin:0 0 0 0;width:auto"><div class="qContent"><div class="qHeader"><abbr class="noborder" title="Question 1">1</abbr>. Please provide your name and e-mail address below. Click done below to submit your vote.</div><div class="qBody"><table cellspacing="0" cellpadding="3" border="0" style="width:100%;"><tbody><tr><td style="width:20%;font-weight:bold;"><label for="text_579095901_6719868704"><span class="hlbl">Please provide your name and e-mail address below. Click done below to submit your vote. &nbsp; </span>Name: (Optional)</label></td><td valign="top"><input id="text_579095901_6719868704" name="text_579095901_6719868704" type="text" size="30" value="" class="open"></td></tr><tr><td style="width:20%;font-weight:bold;"><label for="text_579095901_6719868706">Email Address: (Optional)</label></td><td valign="top"><input id="text_579095901_6719868706" name="text_579095901_6719868706" type="text" size="30" value="" class="open"></td></tr></tbody></table></div></div></div></div></div>
<!--end content area-->
<div id="panButtonBar">

<div style="text-align:center;">
<input type="submit" name="PrevButton" value="Prev" onclick="onesubmit(this);" id="PrevButton" class="btn btntext grey">
<input type="submit" name="NextButton" value="Done" onclick="onesubmit(this);" id="NextButton" class="btn btntext grey">

</div>


</div>







<div class="spacer" style="height:100px;">&nbsp;</div>


<input type="hidden" name="hid_smC0l1d" id="hid_smC0l1d" value="r9nWM11rHijwX3dDZ1G8NQ_3d_3d">
<input type="hidden" name="hid_smRsL1d" id="hid_smRsL1d">
<input type="hidden" name="hid_smRs1d" id="hid_smRs1d" value="mII0H4g5XRCu4s1ZVhHXsg_3d_3d">
<input type="hidden" name="hid_smCSV" id="hid_smCSV">
<input type="hidden" name="hid_smS1d" id="hid_smS1d" value="rbQr6Wx8ieI2e98gDtyjNA_3d_3d">
<input type="hidden" name="hid_smM0D" id="hid_smM0D" value="E6uK1MhOcpBUysyKlC0vrg_3d_3d">
<input type="hidden" name="hid_smV3Rsn" id="hid_smV3Rsn" value="ryjiA1jsXxArHG3rMuiwxg_3d_3d">
<input type="hidden" name="hid_smS3CT1d" id="hid_smS3CT1d" value="IGaEFrQzyw9OHNYpBjkYsg_3d_3d">
<input type="hidden" name="hid_DC" id="hid_DC" value="UTLbMdg3R07bopsDbKUHM51JeIvWdftG8_2bHZNxxsXT_2bITWvXP9m1Zy_2fqRmNPpOx7">
<input type="hidden" name="Hidden_CollectorToken" id="Hidden_CollectorToken">

<input type="hidden" name="Hidden_Simple" id="Hidden_Simple">
<input type="hidden" name="hid_l04dez" id="hid_l04dez" value="RsDrTe_2b1IjsIQj68b5l2TrRCB0SORAXCRx0_2bpMErNSQ_3d">





<div>


</div></form>

【问题讨论】:

  • 另外 onesubmit() 只会阻止您单击按钮 1.5 秒。如果需要,我可以发布代码。

标签: html forms input onsubmit


【解决方案1】:

第一行将您带到另一个页面-

<form name="frmS" method="post" action="/s.aspx?sm=1jFsQEImT6d7s5gJzLre0g%3d%3d" id="frmS">

您将被发送到表单的 action 属性中指定的 URL。

【讨论】:

  • 那 /s.aspx?sm=1jFsQEImT6d7s5gJzLre0g%3d%3d 是同一页。它把我送到了一个完全不同的域。
  • @user2939924 如果你所在的页面是 s.aspx 那么你只需要做 action="?sm=1jFsQEImT6d7s5gJzLre0g%3d%3d"。虽然我认为这不能解决问题。
【解决方案2】:

您正在从服务器收到重定向响应(假设表单上的 action 是您的当前页面;如果不是,则您要去那里)。

如果您想在不导航的情况下提交表单,请创建一个 iframe,并将表单的 target 属性设置为 iframe。

【讨论】:

  • 你知道一个很好的例子吗?也许是教程?我从来没有处理过 iframe。感谢您的回答,尽管这解释了很多。
  • 感谢 Paul Draper 我添加了一个 IFrame 并将其定向到该部分。非常感谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-26
  • 2011-10-25
  • 1970-01-01
  • 2022-01-15
  • 1970-01-01
相关资源
最近更新 更多