By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,963 Members | 1,947 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,963 IT Pros & Developers. It's quick & easy.

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

mikek12004
100+
P: 200
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
Expand|Select|Wrap|Line Numbers
  1. <a onClick="display1(1)" onMouseOver="this.style.cursor='pointer'" class="a3" >click here</a>
and just above
Expand|Select|Wrap|Line Numbers
  1. <form name="f1" id="f1" method="post" action="http://127.0.0.1/dome/main.php?page=69">
  2. <input type="hidden" name="info" id="info"  value=""/> 
  3. </form>
  4.  
  5. <script type="application/javascript">
  6. function display1(num)
  7. {
  8.     if (num=='1')
  9.     {
  10.         document.f1.info.value='PA0720001|02861|02875|02708|02708|PA0720004|PA0720005|PA0720006|11114002169|11114002143|11114004269|11114004249|11114004229|11114000103|11114001109|11115002169|11125002169|BTT0000006|BTT0000005';
  11.     }
  12.     else if (num=='2')
  13.     {
  14.         document.f1.info.value='BTT0000005';
  15.     }
  16.     else if (num=='3')
  17.     {
  18.         document.f1.info.value='BTT0000006|02708';
  19.     }
  20.     //document.f1.action='';
  21.     document.f1.submit();
  22. }
  23. </script>
  24.  
but it opens in the same page and not in a new one as I want any help?
Dec 30 '09 #1
Share this Question
Share on Google+
6 Replies


Dormilich
Expert Mod 5K+
P: 8,639
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?
Dec 30 '09 #2

mikek12004
100+
P: 200
I do not want to lose the previous page (think of it as a page of contents from which the user clicks various links)
Dec 30 '09 #3

Dormilich
Expert Mod 5K+
P: 8,639
then the only thing coming to my mind is window.open(), you may be able to pass something through window.opener.
Dec 30 '09 #4

acoder
Expert Mod 15k+
P: 16,027
Try the target attribute. You can add it with JavaScript if you want.
Dec 30 '09 #5

mikek12004
100+
P: 200
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
Dec 31 '09 #6

acoder
Expert Mod 15k+
P: 16,027
Add it to the form, not to the link
Dec 31 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.