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

How to add address bar on site?

Status
Not open for further replies.

bassliner

Technical User
Jul 31, 2005
4
GB
ive tried the following :


<html>

<head>
<script type="text/javascript" language="JavaScript">
<!--
function GoToURL() {

var URLis;
URLis = document.myForm.Dest.value

if (URLis == "" || URLis.length <= 8)
{
alert('\nOops!\n\nYou must enter a valid URL');
}
else
{
this.location.href = URLis;
}
}
//-->
</script>
</head>

<body>

<form name="myForm">
<input type="text" value=" name="Dest">
<input type="button" value="go to url" onClick="GoToURL()">
</form>

</body>

</html>


but that doesnt work, basically i want people to enter any url (like an address bar) and click Go! to visit the url they have typed in. can someone give me the information to input this onto my site?

thanks
 
Something like this might be what you are after:
Code:
<form name="myForm">
<input type="text" value="[URL unfurl="true"]http://www."[/URL] name="Dest">
<input type="button" value="go to url" onClick="this.location=document.myForm.Dest.value;">
</form>

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
seems good, but do i have to upload it onto a server for it to work properly? becaused i previewed it in firefox and it doesnt direct to an url i entered.
 
Ah... sorry... my fault:
Code:
<form name="myForm">
<input type="text" value="[URL unfurl="true"]http://www."[/URL] name="Dest">
<input type="button" value="go to url" onClick="[COLOR=red]location.href[/color]=document.myForm.Dest.value;">
</form>
Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
After looking at the code a little more... I thought you might want to benefit from the user being able to press enter/return as well as press the button to go to the url they just typed in:
Code:
<form name="myForm" action="" onsubmit="return false">
<input type="text" value="[URL unfurl="true"]http://www."[/URL] name="Dest" onkeydown="if(event.keyCode==13) location.href=this.value;">
<input type="button" value="go to url" onclick="location.href=document.forms['myForm'].Dest.value;">
</form>

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
no, its not because of a popup ;) im creating a portal for the sony psp, as you can surf the internet, and the browser im using doesnt have an address bar.
 
well depends, either you have a 1.5 version of sony psp or the new 2.0 version.

the 2.0 version has a built in browser which does have an address bar.

the 1.5 version has a ripped version from a game called "tenchi no mon". basically you can rune home made programs/games on 1.5/1.0 and you cannot on 2.0.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top