I have a simple application I’m developing that uses three frames:
banner
contents
main
I want links in the content frame to be able to target main with the href value of the link (standard) and also target the banner frame. I also didn’t want to hand code all the links in contents so I decided to use a script to set all of that page’s links’ onclick event to target the banner frame. That all worked fine.
The problem I’m running into is that I want to pass the href value to the banner frame because I want to set up a trail of the links they clicked in the contents frame. Since I was already adding the onclick event, I figured this should be easy by just appending a query string to the URL of the banner’s page, but I hit a snag:
[CODE]function setTop() {
var el = document.getElementsByTagName(‘a’)
for (var i=0;i<el.length;i++)
{
var hrefLink = ‘stats_top1.asp?link=’ + document.links[i].href
el[i].onclick = function() { parent.banner.location.href = hrefLink; };
}
}
The problem is that regardless of which link in the contents frame they click, it passes the href value of the last link on that page. I did some searching and found out why this was happening, but not a work around. Since the frame pages are ASP, I would like to use the QueryString to pass the clicked URL’s href so I have server side options on what to do with it. I have spent the entire day trying to find a suitable workaround, but have nothing.
If you want to look at the frame set I’m working on:
[url]http://www.nyrforum.com/stats.asp
I may be trying different things when you look at it.
Edit: at the moment, I have it putting the address it thinks you clicked on in an alert (for testing) so you can actually see that it’s passing the last link on the content page.