JavaScript Example: Go to a url in a new window

Type a domain name in the following field then press Enter. Then, the browser will visit that url in a new window.

Goto site:

The code looks like this:

function f() {
 var ss = document.getElementById("xx").value;
 open( "http://" + ss );
}
<form action="" onSubmit="f(); return false;">
<p>Goto site: <input id="xx" type="text" size="40" value="example.com"></p>
</form>
2005-06
© 2005 by Xah Lee.