Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

newbie multiple frames problem

 
Chandhrasekar Saravanan
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am new to JavaScript. i have to develop something like this. i have 2 frames an upper and lower frame. i need to display the address of the upper frame in my lower frame . my upper frame is used to browse websites and my lower frame should display the web addresses . i have developed a sample code ,but i have problem in displaying the address of the upper frame in the textbox of the lower frame. please help me with this.
my Frameset code is
<html>
<head>
<title>Testing history and location object javascript</title>
</head>
<frameset rows="76/,24/" >
<frame src="http://www.cnn.com">
<frame src="navaigation.html" >
</frameset>
</html>
my lower frame (navigation.html)code is
<html>
<head>
<title>Navigation Bar</title>
<SCRIPT>
function go_forward()
{
document.write(parent.frames[0].location.href);
}
</SCRIPT>

<!-- Here's the form, with event handlers that invoke the functions above. -->
<FORM NAME="navbar" >
<INPUT TYPE="button" VALUE="Forward" Click="go_forward()">
URL:
<INPUT TYPE="text" NAME="url" SIZE=50>
</FORM>
</head>
</html>

i need to display it in the address in the textbox, but i couldnt so i tested with an button. this works fine for local html pages,but i couldnt display the address like "http://www.cnn.com" or any internet address. also even if i refresh the page i dont get the initial page with button and text. i only get the blank page.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay first off there are security restrictions about getting stuff from other servers/urls which limits you to what you can do
second off the syntax you are using is correct, but I find it to be buggy at times. I would name the frames and access it by the name
example
<frameset rows="76/,24/" >
<frame name="MainF" src="http://www.cnn.com">
<frame name="BottomF" src="navaigation.html" >
</frameset>
</html>
in the bottom frame try this code
<form name="L">
<input type="button" onclick="this.value=parent.document.MainF.location.href" value="click me">
</form>
Eric
 
Chandhrasekar Saravanan
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't there an any other way that i could catch the webaddresses on the flow, like i need to get these web addresses . kindly suggest me an way. history object would not suit my application
Thanking you
Chandhrasekar Saravanan
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic