Highlight iframe link depending on the parent page id onload
<p>Hi I´ve searched all over and did not find any working solution for this
I have a page that holds a iframe with links on the right and i want
the current link to be say red depending on the loaded parent
the case is that if you click on a link in iframe it will reload the both
so i have to make a javascript that always onload knows the paret id and change
class on the corresponding link i guess</p>

<h2>the iframe page contains a bunch of links</h2>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;base target="_top" /&gt;

&lt;script type="text/javascript"&gt;

function highlightCurrentLink() {

var currentLocation = top.document.location.href;
var targetNode;

targetNode = top.document;



targetNode = document.getElementById("data_nav");

links = targetNode.getElementsByTagName("a");

// Search thorugh all links
for (i=0; i&lt;links.length; i++) {
    linkHref = links[i].href;

    if (linkHref==currentLocation) {
        // Set class for different browsers, if link is this link
        links[i].setAttribute("className", "currentlink");
        links[i].setAttribute("class", "currentlink");      
    }
}
}

// Piggy-back fucntion onto onLoad event ............................................
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
  oldonload();
  func();
}
}
}

addLoadEvent(highlightCurrentLink);

&lt;/script&gt;
&lt;body id="aktuellt_data"&gt;
&lt;div id="data_nav"&gt;
&lt;li&gt;&lt;a href="index.htm" name="Aktuellt-link"&gt;Ulvön&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="Seskaro.htm" name="Aktuellt-link"&gt;Seskarö&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="Nordingra.htm" name="Aktuellt-link"&gt;Nordingrå Bensin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="Echo_Oil_Arbra.htm" name="Aktuellt-link"&gt;Eco-Oil Arbrå&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="Ostmarksbygden.htm" name="Aktuellt-link"&gt;Östmarksbyggden&lt;/a&gt;&lt;/li&gt;
</code></pre>

<h2>and the parent contains</h2>

<pre><code>html
&lt;head&gt;

&lt;iframe src="data.htm"&gt;&lt;/iframe&gt;
</code></pre>

<p></p>

<p>here is the adress if you will <a href="http://www.ovikspump.se/aktuellt" rel="nofollow">http://www.ovikspump.se/aktuellt</a></p>

<p>I've solved it now it works </p>
