PDA

View Full Version : help plz (dont know what to call it)


2n193r
09-18-2004, 04:06 AM
I’m new to JavaScript and I wrote this a few months ago. It was meant to change the src of 2 iframes. But the problem is that when I click back it would only change one, then if I hit back again it then would go back again. I wanted to click back and both of them to go back. What should it do?

This is in the header:
<script language="javascript" type="text/javascript">
function changeIt(newpage)
{
return "content.php?id=" + newpage;
}
function changeItb(newpageb)
{
return "title.php?id=" + newpageb;
}
</script>
This is a link:
<a href="#" onClick="frames['bodyframe'].location.href = changeIt(1);frames['titleframe'].location.href = changeItb(1);">page1</a>

if at all possible can u give me an example plzzzz

-thx your time

Mr J
09-18-2004, 06:50 PM
Because of the nature of the "History Object" I do not think it is possible to do what you want using the browsers "Back" button.

You could use a snippet of javascript that will ensure that the correct page is being shown in your titleframe for the page shown in your bodyframe.

The following would be placed in the head section of the page loaded into your bodyframe.

<script>
<!--
if (parent.titleframe.location.href.indexOf("title.htm") == -1){
parent.titleframe.location.href = "title.htm"
}
//-->
</script>

where title.htm is the name of the page that should be loaded into your titleframe

2n193r
09-19-2004, 06:18 AM
thanks for your help.