1

<center>
  <table>
    <form method="post" name="login" enctype="application/x-www-form-urlencoded">
      <tr>
        <td colspan="2" align="center">
          <font face="arial" size="5">Areá do Cliente</font>
        </td>
      </tr>
      <tr>
        <td>
          E-mail:
        </td>
        <td>
          <input type="text" name="credential_0" value="" size="30" maxlength="128" class="formfield">
        </td>
      </tr>
      <tr>
        <td>
          Senha:
        </td>
        <td>
          <input type="password" naem="credential_1" size="20" maxlength="50" class="formfield">
        </td>
      </tr>
      <tr>
        <tr>
          <input type="submit" name="Log In" value="Check Mail" onclick="javascript:login.action='https://thewebsite.com/mail/index.bml?s=1';javascript:login.destination.value = '/mailadmin/index.bml?check=1';">
        </td>
        <td>
          <input type="submit" name="Log In" value="Manage Mail" onclick="javascript:login.action='https://thewebsite.com/mailLogin';javascript:login.destination.value = '/mailadmin/index.bml?manage=1';">
        </td>
      </tr>
      <input type="hidden" name="destination">
    </form>
  </table>
</center>

I am not an expecialist but i don't know much of javascript, also i need a little help on the full code. Check for me if it's all ok! But my main question is how i make this button open in a new window/tab or set url parent?

https://thewebsite.com/mail/index.bml?s=1';javascript:login.destination.value = '/mailadmin/index.bml?check=1';" >

Wais Kamal
  • 5,858
  • 2
  • 17
  • 36
Patrick Sterza
  • 53
  • 1
  • 1
  • 7
  • rather than separate buttons, make it simply an option on the form (e.g. dropdown list, radio button. something like that). Then either a) post back to some server code which reads the option selected, and (if the user is also authenticated successfully) redirects to the relevant page, or b) run some JavaScript when the form is submitted which prevents the default form submission, reads the option value, sets the "action" attribute appropriately, and finally submits the form using JavaScript. – ADyson Oct 01 '18 at 15:16
  • ok but how i add the code to the javascript i mean where i add the code to make it open in the new tab or in the same page, because Chrome and other browsers aren't opening frames via that CHECK EMAIL button – Patrick Sterza Oct 01 '18 at 21:29
  • None of what I wrote has anything to do with opening in a new tab. I was suggesting about how to improve your form submission code, since it's a bit messy Since you're submitting a form, you can't easily make it submit to a new tab. But you can google about it. https://stackoverflow.com/questions/30835990/how-to-submit-form-to-new-window has one possible answer. Lots of other suggestions are available as well: https://www.google.co.uk/search?q=js+submit+form+to+new+tab&oq=js+submit+form+to+new+tab&aqs=chrome..69i57j0j69i64l2.3656j0j7&sourceid=chrome&ie=UTF-8 – ADyson Oct 02 '18 at 07:48

1 Answers1

1

<a target="_blank" href="https://www.wikipedia.org/">Wikipedia (opens in a new window)</a>

You can open page in new tab or page by using anchor tag very easily. Like,

<a href="/" target="_blank">The home page will open in another tab.</a>

Read more:

https://html.com/attributes/a-target/#ixzz5Sh13WUpK

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

Sandip Nirmal
  • 2,283
  • 21
  • 24