Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send url to external webpage opened via a form

Status
Not open for further replies.

llamatron

MIS
Aug 29, 2003
10
GB
I have a main window that submits a form to a website and opens up the results in a new window,
the action of the form is an external webpage. :

<form name=&quot;form1&quot; method=&quot;post&quot; target=&quot;_blank&quot; action=&quot; >

and I obviouslly have a submit button :

<input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;Submit&quot;>

However I want to communicate with this new window and change the URL of it after the page has been fully loaded,
automatically.
How do i reference the new window to do this?

-------------------------------------------------------------------------------------------------------------

I have tried doing this :

<input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;Submit&quot; onsubmit&quot;=newin()&quot;>

where newin is the following function :

function newin()
{
var new_window = window.open(&quot;}

I tried changing onsubmit=&quot;newin()&quot; to onclick&quot;=newin()&quot; but it still did nothing. But I think this somehow conflicts with the form submit method? How do I name the externalpage.asp window as a variable so I can communicate with it and send a URL to it?
Thanks,
 
you should be able to like so:

function newin()
{
var new_window = window.open(&quot;about:blank&quot;,&quot;html_name&quot;,&quot;width=200,height=600&quot;;);
}

<form name=&quot;form1&quot; method=&quot;post&quot; target=&quot;_blank&quot; action=&quot; >


<input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;Submit&quot; onclick=&quot;newin()&quot;>



=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
No; that would go to a brand new blank web page NOT the window I submit the form to, which isn't what I want.
Anyway, I figured out how to do what I want but only with a manual link on the main page:

<form name=&quot;form1&quot; method=&quot;post&quot; target=&quot;popup&quot; action=&quot; onsubmit=&quot;window.open ('about :blank','popup','width=300,height=300');&quot;>

and put the following link into the main page :

<a href=&quot; target=&quot;popup&quot;>link text</a>

When I click this link, the link opens up in the popup-page I want and correctly displays the data I want. However I want this link to be loaded automatically not as a clickable link from the main page (there doesn't appear to be a target=&quot;&quot; for windows.location.href). Does anyone know how to do this?
Thanks again,


Last edited by llamatron on
 
if you wanted that second URL to be submitted automatically, you could do this:

var f = document.forms[0];
f.action = &quot;f.target = &quot;popup&quot;;
window.open('about:blank','popup','width=300,height=300');
f.submit();


=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top