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

  • SEARCH
  • Home
  • 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 8063769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:09:11+00:00 2026-06-05T11:09:11+00:00

This problem seems to be odd to me and I can’t seem to fix

  • 0

This problem seems to be odd to me and I can’t seem to fix it. I do have a simple HTML form; inside, I do have a textbox and a button as shown down here:

<form id="form1" method="get"> <!-- Note: No Action property -->
    <div>
       <h1>
           Simple Test Form</h1>
       <table border="0" width="400">
           <tr>
               <td align="right">
                   All of these words
               </td>
               <td>
                   <input name="txtAll" id="txtAll" type="text" value="testing keyword" />
               </td>
           </tr>
           <tr>
               <td colspan="2" align="center">
                   <input type="submit" name="Submit" value="Submit" onclick="myJS(this);" />
               </td>
           </tr>
       </table>
   </div>
</form>

MyJS file is as:

<script type="text/javascript">
    function myJS(which) {
        var CONSTANT_SITE_TARGET = "http://servername/redirect/target.aspx?text=";

        //capture all values from the form
        var allWords = document.getElementById("txtAll").value;

        var morestring = ""; //More data manipulation here.....
        var url = CONSTANT_SITE_TARGET + allWords + morestring;

        window.open(url);
        //window.location = url;          //Doesn't work
        //window.location.href = url;     //Doesn't work
        //self.location = url;            //Doesn't work
        //top.location = url;             //Doesn't work
    }
</script>

As you can see, it doesn’t redirect to the designated URL in the javascript. When I use the window.open then it works. Note that in the < form… > tag, I don’t put the action property in it. I don’t want to open a new browser, just redirect to the new url within the same browser.

Is there a way to redirect it?

  • 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-05T11:09:13+00:00Added an answer on June 5, 2026 at 11:09 am

    Here

    function myJS(which) {
        var CONSTANT_SITE_TARGET = "http://servername/redirect/target.aspx?text=";
    
        //capture all values from the form
        var allWords = which.txtAll.value;
    
        var morestring = ""; //More data manipulation here.....
        return CONSTANT_SITE_TARGET + allWords + morestring;
    }
    
    
    <form id="form1" method="get" onsubmit="this.action=myJs(this)">
    <div>
        <h1>
            Simple Test Form</h1>
        <table border="0" width="400">
            <tr>
                <td align="right">
                    All of these words
                </td>
                <td>
                    <input name="txtAll" id="txtAll" type="text" value="testing keyword" />
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="submit" name="Submit" value="Submit" />
                </td>
            </tr>
        </table>
    </div>
    </form>
    

    to elaborate on a comment:

    <script>
    window.onload=function() {
      document.getElementById("Submit").onclick=function() {
         var CONSTANT_SITE_TARGET = "http://servername/redirect/target.aspx?text=";
        //capture all values from the form
        var allWords = document.getElementById("txtAll".value;
        var morestring = ""; //More data manipulation here.....
        location = CONSTANT_SITE_TARGET + allWords + morestring;
      }
    }
    </script>
    <div>
        <h1>
            Simple Test Form</h1>
        <table border="0" width="400">
            <tr>
                <td align="right">
                    All of these words
                </td>
                <td>
                    <input name="txtAll" id="txtAll" type="text" value="testing keyword" />
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="button" id="Submit" value="Submit" />
                </td>
            </tr>
        </table>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This problem seems very simple to me, but I've been unable to fix it,
This one seems to be a simple problem, but I can't make it work
I have an issue that seems like very flaky behavour, is this a problem
I am seeing this somehow odd problem (even though I have the feeling I
I have a very odd issue trying to run this quite simple C program
I am struggling for days to solve this problem and it seems i cant
My problem seems to be this: heap data allocated by one thread (that later
Seems that This will be an easy question for you but this problem is
Hi i encountered this problem whereby when i initialized my String[], there seems to
I'm really suprised I haven't run into this problem before, but it seems that

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.