...

View Full Version : Address Bar on page



thesmart1
08-10-2006, 12:44 AM
Is there a way to make like an address bar on a webpage? Maybe a text input box with a button or link that opens the page in that window?

Kravvitz
08-10-2006, 01:41 AM
Sure, you could make a form that acts like one.

Why would you want to do that though?

thesmart1
08-10-2006, 03:00 AM
I'm trying to make a side bar for myself in frames and surf the web in the main frame. I was just wondering if it would be possible to put an address bar on a page in the main frame. It would probably be done in DOM, but I'm not sure.

_Aerospace_Eng_
08-10-2006, 03:07 AM
Place this in your top frame or side frame

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>&nbsp;</title>
<style type="text/css">
html, body {
margin:0;
padding:0;
border:0;
text-align:center;
}
body {
padding:5px;
}
form {
margin:0;
padding:0;
}
</style>
<script type="text/javascript">
function goTo()
{
window.frames['main'].location = document.forms[0].url.value; // change main to the name of your frame
return false;
}
</script>
</head>

<body>
<form action="#" method="post" onsubmit="return goTo()">
<label for="url">Address: <input type="text" name="url" id="url" size="75"></label>
<input type="submit" value="Go">
</form>
</body>
</html>
Read the comments in the JS to see how to get the url to open in the main frame.

thesmart1
08-10-2006, 06:23 PM
It's not working

_Aerospace_Eng_
08-10-2006, 06:58 PM
Then you've done something wrong. Post the code for your frameset.

thesmart1
08-12-2006, 08:21 PM
Home.html:


<html>
<frameset rows="100,*">
<frame name="topbar" src="topbar.html">
<frame name="main" src="http://www.msn.com">
</frameset>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum