Hello to you all,
This is my first message on the Webdeveloper.com, great website as I have seen so far...
This is my problem. I got a javascript that seems to work fine in FF 1.5.0.6, but not in IE (6)...Here is my description of my problem.
It might be a problem on "windows.onload" in combination of IE, but I do not know enough of Javascript, to be honest
Any help is welcome, thanks in advance...
Below is the code of a html-page and a JS-code, which I want to use so information of a website shows up, as soon as you scroll over a certain thumbnail...Example (in FF) that works on: http://www.avonturiers.nl/links_new.html
========================== html page =======================
<div id="show"></div>
<div id="links">
<a href="#afrikanieuws"><img src="images/links/tn_afrikanieuws.jpg" alt="Afrikanieuws"></a>
<ul id="afrikanieuws" style="display:none">
<li><b>Afrikanieuws</b></li>
<li><a href="http://www.afrikanieuws.nl" target="_blank">http://www.afrikanieuws.nl</a></li>
<li>Description on Afrikanieuws</li>
</ul>
<a href="#cama"><img src="images/links/tn_camanl.jpg" alt="CAMA Zending Nederland"></a>
<ul id="cama" style="display:none">
<li><b>CAMA</b></li>
<li><a href="http://www.cama.nl" target="_blank">http://www.cama.nl</a></li>
<li>Description on CAMA</li>
</ul>
</div>
</div>
========================JS script ===========================
// Will DOM JavaScript be supported?
if(document.getElementById && document.createTextNode)
{
// add onload attribuut
window.onload = setUp;
}
function setUp()
{
var as = document.getElementById('links').getElementsByTagName('a');
// add a onclick-functie to every link
for(i = 0; i < as.length; i++)
{
as.onmouseover = function(){
show(this);
return false;
}
}
}
function show(s)
{
var id = s.href.match(/#(\w.+)/)[1];
var uls = document.getElementById('links').getElementsByTagName('div');
for(i = 0; i < uls.length; i++)
{
uls.style.display = "none";
}
// Give the <ul>'s a display=block to let the text come up
document.getElementById(id).style.display = "block";
}