hello,
I have no idea of ASP (i´m php programmer) but my problem has exactly the same title than this one, so i will post it here.
ok, I hate IE :(, but I need to program things for it. And this code does not work. In my main file have a table where each row has two DIVs. the code is the following:
Code:
<DIV id="bloques">
<table class="tabbloques" ><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr><tr><td>
<DIV class="bloque"></div><DIV class="inbloque" >Cargando...</div>
</td></tr></table>
</div>
well, then I try to attach events to them: when I click on "bloque" DIV, I want "inbloque" to appear and disappear (really easy).
I use the Eventutil.
js code from Nick Zakas book. My code is the following:
Code:
function clickblock() {
var bloqs = document.getElementById("bloques");
var divs = bloqs.getElementsByTagName('DIV');
alert(divs.length);
var divCounter = 1;
for(var no=0;no<divs.length;no++){
if(divs[no].className=='bloque'){
divs[no].id = 'bloque'+divCounter;
divs[no].nextSibling.id = 'inbloque'+divCounter;
EventUtil.addEventHandler(divs[no], 'click', toggle);
divCounter ++;
}
}
}
I mean, I search for DIVS inside "bloques" and I alternate them the IDs and I attach the clickon toggle function to "bloqueX" DIVS.
It works properly in FF, but... in IE I have the following behaviour:
- If I execute the code as it is above, only the first DIVS couple will work (I mean, the toogle function will work).
- If I remove the TABLE, TR and TDs tags, then it won´t work in the FIRST couple of tags but it will work in the rest 9 cople of DIVS tags!!
I have no idea what is happening. If I can´t solve this I will have to detect the browser from the server-side and Use different PHP code for each :(
I hate IE