I have this JS code:
<script type="text/javascript">
function start() {
document.forms[0].username.focus();
var celdas;
var tabla;
tabla = document.getElementById("tabla");
celdas = tabla.getElementsByTagName("td");
for (var i=0; i<celdas.length; i++) {
if (celdas[i].innerHTML == "<b>Please Login</b>"){
celdas[i].innerHTML = "<b>Identificación de usuario</b>"
}
if (celdas[i].innerHTML == "<b>Name:</b>"){
celdas[i].innerHTML = "<b>Nombre:</b>"
}
if (celdas[i].innerHTML == "<b>Password:</b>"){
celdas[i].innerHTML = "<b>Contraseña:</b>"
}
}
boton = document.getElementById("login_button");
boton.value="Entrar";
}
window.onload = start;
</script>
To this html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--head, meta tags, body and other stuff--->
<table class="list" id="tabla">
<tr class="dark">
<td colspan=2></td>
</tr>
<tr class="dark">
<td colspan=2><b>Please Login</b></td>
</tr>
<!-- ETC ETC - more table stuff-->
The HTML pass the validation, and the JS works in Firefox and IE9, but not in IE8 even IE7. When I debug the JS step by step, I see that IE8 stops at here:
if (celdas[i].innerHTML == "<b>Password:</b>")
But do not enter this step:
celdas[i].innerHTML = "<b>Contraseña:</b>"
I'm not very fluent in JS, so, perhaps I'm doing a completely stupid n00b error... is my code right? Why it doesn't work?