How can I make the document.formname.submit() to open in a new window?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mikek12004
    New Member
    • Sep 2008
    • 200

    #1

    How can I make the document.formname.submit() to open in a new window?

    Upon clicking on a link I want to go to another page with lots of data (which I do not wish to pass through GET so I used post like this)
    the links is
    Code:
    <a onClick="display1(1)" onMouseOver="this.style.cursor='pointer'" class="a3" >click here</a>
    and just above
    Code:
    <form name="f1" id="f1" method="post" action="http://127.0.0.1/dome/main.php?page=69">
    <input type="hidden" name="info" id="info"  value=""/> 
    </form>
    
    <script type="application/javascript">
    function display1(num)
    {
    	if (num=='1')
    	{
    		document.f1.info.value='PA0720001|02861|02875|02708|02708|PA0720004|PA0720005|PA0720006|11114002169|11114002143|11114004269|11114004249|11114004229|11114000103|11114001109|11115002169|11125002169|BTT0000006|BTT0000005';
    	}
    	else if (num=='2')
    	{
    		document.f1.info.value='BTT0000005';
    	}
    	else if (num=='3')
    	{
    		document.f1.info.value='BTT0000006|02708';
    	}
    	//document.f1.action='';
    	document.f1.submit();
    }
    </script>
    but it opens in the same page and not in a new one as I want any help?
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    but it opens in the same page and not in a new one as I want any help?
    why should it open in a new page?

    Comment

    • mikek12004
      New Member
      • Sep 2008
      • 200

      #3
      I do not want to lose the previous page (think of it as a page of contents from which the user clicks various links)

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        then the only thing coming to my mind is window.open(), you may be able to pass something through window.opener.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Try the target attribute. You can add it with JavaScript if you want.

          Comment

          • mikek12004
            New Member
            • Sep 2008
            • 200

            #6
            try the target attribute in js
            Tried to put it directly in the <a> tag didn't do anything, haven't tried to put it through js but probably will have the same effect

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Add it to the form, not to the link

              Comment

              Working...