Click to See Complete Forum and Search --> : Need help with links...


krismisz
01-17-2003, 07:56 PM
I was wondering if anyone could help me with the following. I have a framespage with two frames, the header and the mainframe . The links are contained in the header and they load within the mainframe. Is there a way to disable a link once that page is loaded within the mainframe without having to reload an entirely new framespage?

Any help would be greatly appreciated!
Krismisz

(ps. would there be a simpler way to do it in HTML?)

BestZest
01-18-2003, 12:36 PM
This might not work, i havn't tested it:

<script language="JavaScript">
var oldlink
loc=new Array("page1.html","page2.html","page3.html")

function disable(link) {
if(oldlink){document.links[oldlink].href=loc[oldlink]};
document.links[link].href="#";
oldlink=link;
}
</script>
Edit the 'loc' array to the pages, and if the first navigation link isn't the first link on the page you'll have to change
document.links[oldlink].href=loc[oldlink];
to something like
document.links[oldlink].href=loc[oldlink-1];
or -2
You also have to put in each of the link's:
onclick="disable(num)"
where num is the number of link on the page (starting with 0, zero)

The 'disable' function sets the link's 'href' value to "#" so it won't do anything. When another link is clicked, the 'oldlink' s 'href ' value is set back to the original.

Hope this helps (and works ;) )

BestZest