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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get Form URL value to launch in new window!!

Status
Not open for further replies.

polly297

MIS
Oct 11, 2000
5
GB
Hi Guys,

Sorry if you have seen this question before. I have tried searching for previous posts, as I know I have seen this example in here before. But it is always the way, when you are in a rush, you cant find it!

Ok, given that JS is not my strong point..this is what I want to do:

Page in frameset, has a simple form with one field asking user to enter a URL. On submit, I want a function that will open a new window with the form submitted URL in it!!

Should be very simple, and I suspect I have done something stupid...can someone confirm and correct this please? :)

function launchURL(page) {
var page = this.address.extURL.value;
window.open('page', 'newWindow2', "menubar=no");
}

<form name=&quot;address&quot; onSubmit=&quot;Javascript: launchURL(address.value)&quot; action=&quot;CallsSamePage.cfm&quot; method=&quot;post&quot;>
<input type=&quot;text&quot; value=&quot; size=&quot;75&quot; name=&quot;extURL&quot;>
<input type=&quot;submit&quot; value=&quot;GO&quot;>
</form>

Any help appreciated,
thanks
Emma
 
Hi Emma, I'm no expert either, but this seems to work. If you want an explanation I'll do my best.
Code:
<script>
function launchURL(page) {
window.open(page, 'newWindow2', &quot;menubar=no&quot;);
}
</script>

<form name=&quot;address&quot; onSubmit=&quot;javascript:launchURL(this.extURL.value)&quot; method=&quot;post&quot;>
<input type=&quot;text&quot; value=&quot;[URL unfurl="true"]http://&quot;;[/URL] size=&quot;75&quot; name=&quot;extURL&quot;>
<input type=&quot;submit&quot; value=&quot;GO&quot;>
</form>
Greg.
 
Hi Greg,
I have tried that, but alas it doesn't work, the new window isnt even launched.

I am using IE 5.5 - if that bears any relevance.

any other ideas?
Cheers
Emma
 
In the example you originally posted you have apostrophes around the page variable name. Did you try taking those out, like in the example greg posted?
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Thanks!!
I didn't have have the quotes around the variable, but not to worry, because it works now! ;-)

Don't know what I did/or didn't do the first time, but it works, so I am happy.

cheers
Emma


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top