jwhittlestone
Programmer
Hi people,
With a non-frames page, I wanted to alter an anchor/hyperlink using javascript so i used the following code:
<code>
function changelink()
{
homebutton = document.getElementById("mainNav").firstChild;
homebutton.href = "anotherurldotcom";
}
</code>
This function was invoked with onload as an attribute of the body tag. This worked fine.
Now, the eventual outcome, is to do this with a framed page, but I have no idea how this is done!
So, i tried this function that is defined in the parent frame
<code>
function changelink()
{
homelink = window.frames["mainFrame"].getElementById("mainNav").firstChild;
homelink.href = "anotherurldotcom";
}
</code>
And then invoked it with an onload() attribute of the frame tag
But it doesn't seem to want to play ball.
You can see my efforts here..
barbaryonline.com/jw/t3_temp/
thanks for any help that you may be able to shed on this tricky one (for me)
jon
With a non-frames page, I wanted to alter an anchor/hyperlink using javascript so i used the following code:
<code>
function changelink()
{
homebutton = document.getElementById("mainNav").firstChild;
homebutton.href = "anotherurldotcom";
}
</code>
This function was invoked with onload as an attribute of the body tag. This worked fine.
Now, the eventual outcome, is to do this with a framed page, but I have no idea how this is done!
So, i tried this function that is defined in the parent frame
<code>
function changelink()
{
homelink = window.frames["mainFrame"].getElementById("mainNav").firstChild;
homelink.href = "anotherurldotcom";
}
</code>
And then invoked it with an onload() attribute of the frame tag
But it doesn't seem to want to play ball.
You can see my efforts here..
barbaryonline.com/jw/t3_temp/
thanks for any help that you may be able to shed on this tricky one (for me)
jon