English 中文(简体)
表格未在单击文本时提交
原标题:Form not submitting on text click

这是我在点击文本时通过这个表格提交的, 但数值不会在动作页面上传递 。

  <form action="forget_pass.php" method="post" id="new_user" name="new_user">
  <ul class="inputlist">
    <li><span class="redcolor">*</span>Email Address or Phone No.</li>
    <li>
      <input name="" class="inputbox" type="text" name="EmailAddress" id="txtEmail" />
      &nbsp;&nbsp;

      </li>

     <li class="rightalign">
     <a href="javascript:document.new_user.submit();" onclick="">
      Retrieve Password</a></li>

    </form>
最佳回答
<input name="" class="inputbox" type="text" name="EmailAddress" id="txtEmail" />

应该是

<input class="inputbox" type="text" name="EmailAddress" id="txtEmail" />

- 带

<a href="javascript:document.new_user.submit();" onclick="">

最好

<a href="#" onclick="document.new_user.submit();return false;">
问题回答

您可以在此使用工作代码

<form action="forget_pass.php" method="post" id="new_user" name="new_user">
  <ul class="inputlist">
    <li><span class="redcolor">*</span>Email Address or Phone No.</li>
    <li>
      <input class="inputbox" type="text" name="EmailAddress" id="txtEmail" />
      &nbsp;&nbsp;

      </li>

     <li class="rightalign">
     <a href="javascript:document.new_user.submit();">
      Retrieve Password</a></li>

    </form>

你的代码有问题

1 - 您有两个名称属性。 1 是空的

点击 2 时未正确使用...

希望有帮助

你应该试试这个代码

<form action="forget_pass.php" method="post" id="new_user" name="new_user">
  <ul class="inputlist">
    <li><span class="redcolor">*</span>Email Address or Phone No.</li>
    <li>
      <input class="inputbox" type="text" name="emailAddress" id="txtEmail" >
      &nbsp;&nbsp;
      </li>
     <li class="rightalign">
     <a href="javascript:submitForm();">
      Retrieve Password</a></li>
    </ul>
</form>

javaScript代码是,

submitForm = function(){
    alert(document.forms[0].emailAddress.value);
document.forms[0].submit();
}

运行的代码是 ""http://jsfiddle.net/4AWW6/" rel="nown" >http://jsfiddle.net/4AWW6/





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签