Connecting Tech Pros Worldwide Help | Site Map

Putting an URL from FORM to address bar (no new window)

Kuba Glad
Guest
 
Posts: n/a
#1: Jul 23 '05
Hi,

I've spent some time using google, and reading basic manuals about Java
Scripts and forms, but I can't find solution to this simple problem.

In web page I want a such type of form like shown below. When someone
enters an URL to text box, and hits return or clicks on "go" button,
browser would load desired page (but without opening new page).

<form name="enter_url">
<input type="text" name="address" >
<input type="button" name="go" value="GO">
</form>

Could someone write a JavaScript code that makes it ? and where I should
put it in form ?

Tired of looking and trying

Kuba Gladykowski
Evertjan.
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Putting an URL from FORM to address bar (no new window)


Kuba Glad wrote on 04 apr 2004 in comp.lang.javascript:[color=blue]
> I've spent some time using google, and reading basic manuals about Java
> Scripts and forms, but I can't find solution to this simple problem.
>
> In web page I want a such type of form like shown below. When someone
> enters an URL to text box, and hits return or clicks on "go" button,
> browser would load desired page (but without opening new page).
>
> <form name="enter_url">
> <input type="text" name="address" >
> <input type="button" name="go" value="GO">
> </form>[/color]

<form
onsubmit="
location.href=
document.getElementById('myText').value;
return false;">

<input type="text" id="myText">
<input type="submit" value="GO">
</form>

URL with http:// necessary, both enter and button click work

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Kuba Glad
Guest
 
Posts: n/a
#3: Jul 23 '05

re: Putting an URL from FORM to address bar (no new window)


It really works - thank you veeeeery much.
Closed Thread