Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8692539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:19:55+00:00 2026-06-13T00:19:55+00:00

I have a simple HTML input form with a button. Fist I added javascript

  • 0

I have a simple HTML input form with a button. Fist I added javascript so the form can be submitted by pressing enter key not only by clicking button. That worked perfectly. After that I added javascript so when certain keyword is entered the user gets redirected to some other URL. Here is where the problem came. The users get redirected normally when pressing button, but when I press enter it leads me to 404 page. Here is my code:

<script type="text/javascript">
<!--
function enter(e){
    if(e.keyCode == 13)
        Login();
}
//-->
</script>

 <script type="text/JavaScript">
 <!--
 function Login(){
 var keyword=document.getElementById("address").value;
 var done=0;
 keyword=keyword.toLowerCase();
 keyword=keyword.split(' ').join('');
 if (keyword=="example,example") { window.location="http://www.example.com"; done=1; }
 if (keyword=="example1") { window.location="http://www.example1.com"; done=1; }
 if (keyword=="example2") { window.location="http://www.example2"; done=1; }
 if (done==0) { codeAddress(); }
 }
 //-->
 </script> 

<form name="enterkeyword" action="none">
    <input name="keyword" id="address" type="text"  onkeypress="return enter(event);"/>
    <div class="buttons">
    <button type="button" onclick="Login()">Submit</button>
    </div>
    </form>

Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:19:56+00:00Added an answer on June 13, 2026 at 12:19 am

    Change:

    <script type="text/javascript">
    <!--
    function enter(e){
        if(e.keyCode == 13)
            Login();
    }
    //-->
    </script>
    

    to

    <script type="text/javascript">
    <!--
    function enter(e){
        if(e.keyCode == 13)
        {
            Login();
            return false;
        }
    }
    //-->
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some very simple HTML: <div id=advisor> <div id=print_this_container> <form> <input type=button value=
I have a pretty simple HTML form where users can enter in information about
I have a simple html login form which is validated with javascript before its
I have a site that has a simple HTML button in a form. All
I have a simple FORM , one INPUT and one SUBMIT Button . The
I have a simple HTML form, thus: <form> <p> <input type=text name=text /> </p>
I have a simple html form like this <table> <tr><td >Topic: </td> <td> <input
I have a form button with an onclick event that runs a simple javascript
i have this simple html form: <form action=test/ method=get accept-charset=utf-8> <input type=text name=first value=
i have this simple html form: <form action=test/ method=get accept-charset=utf-8> <input type=text name=first value=

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.