Blank box which opens any URL HTML?

Suspended
Joined
7 Mar 2006
Posts
136
Hi all,

What I'm looking for is a simple code that will simply display a box on a page which will open the URL that someone types into it in a new window.

So a blank box and a button that says "Launch" or something and it opens a website that you type in to the box in a new window!

Could some clever person provide a bit of code that does this please :)

Cheers!
 
Code:
<form method="get" action="" onsubmit="location.href = document.getElementById('url').value; return false;">
<input type="text" id="url" />
<input type="submit" value="Go" />
</form>
 
Cheers! Is there a way to get it to open a new window however rather than reusing the same window? It will be used to point to PDFs to open them in new windows rather than using the same window!

This way people can just type in a different address each time and open multiple windows :)
 
not tested but something like-

Have a javascript function to make a new popup window
Code:
<script language="javascript">
 function popupWin(url) 
{
newWin = window.open(url, 'New','toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1');
}
</script>
Then a button to fire it
Code:
<form>
<input type="text" id="url"><br  />
<input type="button" id="submit" onClick="Javascript: popupWin(document.getElementById('url').value;)">
</form>

Not tested but should do the job :o

Edit: oops, this is just the long version of what MastermindUK said but with more options to customize the popup window
 
Back
Top Bottom