...

View Full Version : "custom location bar"



rlyesq
01-27-2009, 06:07 PM
I'm trying to get a variation of the CUSTOM LOCATION BAR on http://www.sivamdesign.com/scripts/navigate.html (code can be found at http://www.sivamdesign.com/scripts/dwld/location.txt )to work.

Basically, I want to have users enter a string (e.g., 1234) into a text box, click on the GO button, and then be taken to
http://domain.com/page.php?1234

Is that possible, and if so, how is it done?

Any help is greatly appreciated!

angst
01-27-2009, 06:14 PM
this should work


<script>
function GoToLocation(url){
location.href='http://' + url;
}
</script>

<input type='text' name='url' id='url' /><input type='button' value='Go' onClick='GoToLocation(document.getElementById("url").value);' />

rlyesq
01-27-2009, 06:18 PM
Worked perfectly. Thanks for the prompt response!

rlyesq
01-27-2009, 06:49 PM
Is there a way to have the script detect the browser, and if it's IE, to have the new page open in a new window?

angst
01-27-2009, 06:52 PM
try this


<script>
function GoToLocation(url){
var browser=navigator.appName;
if( browser == "Microsoft Internet Explorer" ){
window.open("http://" + url,"mywindow","status=1");
} else {
location.href='http://' + url;
}
}
</script>

rlyesq
01-27-2009, 06:57 PM
Thanks again!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum