Home link with frames !?

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
 
R

Robert

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,254
Latest member
Top Crypto TwitterChannel

Latest Threads

Top