By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,932 Members | 1,474 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,932 IT Pros & Developers. It's quick & easy.

Home link with frames !?

P: n/a
Aki
Hi!

I've been trying to create a home link in a document that is shown in
a frameset of two frames. My aim is to show the first documents that
were shown in the frames when the frameset was loaded the first time.
The link works perfectly in NN4.5 and 7.1, but IE6 and Opera7 are
causing headaches.

I've tried to do the link with the following script:

function home(h,g)
{
parent.fRight.history.go(h-parent.fRight.history.length);
parent.fLeft.history.go(g-parent.fLeft.history.length);
}

fRight and fLeft are frame names. The function is then called in the
following link:

<a href="javascript:home(1,1)">Opening page </a>
How can I get even IE and Opera to understand me?

I would be grateful for help!

Aki
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> I've been trying to create a home link in a document that is shown in
a frameset of two frames. My aim is to show the first documents that
were shown in the frames when the frameset was loaded the first time.
The link works perfectly in NN4.5 and 7.1, but IE6 and Opera7 are
causing headaches.

I have implemented a home like function for a frame. You will want to
write these files out to disk in the same folder. Start the file
frames.html. Click on the Yahoo link in frame 2. Click on the link
Original Frame 2 link.

IE may be have a restriction that you can only use numbers -1, 0, and
1 in the go function. This would correspond to back, reload, and
forward.

I am not totally sure how or in what way you wish to go back to the
original page.

I have implement some javascript code that lets you load the page
referenced in the frame tag. What I do is grap the src value from
within the frame tag on the page with the frameset tag. See funtion
setFrame in the control.html file. You may run into security
restrictions with these files if the link isn't in a file that is
stored on in the same directory as the file with the frameset.

I have tried this in Netscape 7.1, IE 5.2, and Safari in MacOS 10.2.6.

Robert
frames.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Frames Layout</title>
</head>
<frameset rows="45%,45%,*" >
<frame src="frame1.html"
id="myframe1"
name="nameframe1"
scrolling=yes>
<frame src="frame2.html"
id="myframe2"
name="nameframe2"
scrolling=yes>
<frame src="control.html"
id="mycontrol"
name="namecontrol"
scrolling=yes>
</frameset>
</html>

frame1.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Frame 1</title>

</head>

<body>
<p>This is frame 1.</p>
<a href="http://www.google.com">Google</a>
</body>
</html>
frame2.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Frame 2</title>

</head>

<body>
<p>This is frame 2.</p>
<a href="http://www.yahoo.com">Yahoo</a>
</body>
</html>

control.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Control</title>
<SCRIPT type="text/javascript">

function setFrame(frameId)
{
var node = top.document.getElementById(frameId);

var mySRC = node.getAttribute("SRC");

alert("the location for replacement = " + mySRC);

top.frames["nameframe2"].window.location.replace(mySRC);
}

function changeFrame1()
{
top.frames["nameframe1"].window.location =
"http://www.google.com/news";
}

</script>
</head>
<body>
<a href="http://www.google.com"
onclick="changeFrame1();return false">link
to Google News in Frame 1</a>
&nbsp;&nbsp;&nbsp;
<a href="http://www.yahoo.com"
onclick="setFrame('myframe2');return false;">Original
Frame 2</a>
</body>
</html>
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.