I copy a script of Kevin S (member of this site) like this
<table class="personid">
<tr>
<td class='personid'>i</td>
<td>Harry</td>
</tr>
<tr>
<td class='personid'>i</td>
<td>Simon</td>
</tr>
<td class='personid'>i</td>
<td>Maria</td>
</tr>
</tr>
<td class='personid'>i</td>
<td>Victory</td>
</tr>
</table>
<script>
var list = document.getElementsByClassName("personid");
for (var i = 1; i <= list.length; i++) {
list[i].innerHTML = i;
}
</script>
I don't know why This script can run smoothly in Chrome and Firefox but it can't not run in IE 7. How can i make it can decode in IE 7. (See in IE7 it's only present i instead of 1 2 3 4 5)
One more question: When i remove the class="personid" on tag Table
The result is i - 1 - 2 - 3 -
When i add class = "personid" on tag table
The result is 1 - 2 - 3 - 4 -
Why it comes like this ? Because i think the script is only change the variable "i" on which td have the personid class name.
Thanks for your help, i also enclose my previous post and i make a new question because it's passed over. Sorry for the inconvenience!
http://stackoverflow.com/questions/11026258/html-and-javascript-auto-increment-number