Question : Get all rows in table in IE

Hello I have a table which has a few rows. And I am trying to get the ids of all the rows to manipulate row data. But the problem is, I am only able to retreive rows with unique IDs but not rows with same IDs. This script is working well in FF but I am not able to understand why it isn't working the same way in IE. I have also checked the DOM and both are similar. So I am recreating the error in pilot level, and I have added the code snippet which works the same way my problem is.

I am using Firefox and IE8 for testing. This works fine with FF but is giving me trouble in IE8. In FF I get all the row IDs, but in IE8 I only get the 1st, 4th and 5th row, since they have unique row Ids. I know this might sound crazy, but what has unique ID to do with DOM parsing?? I am not sure how to go ahead with this problem, any clue for solving this would be a great help.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
<html>
<head>
<script type = 'text/javascript'>
function cmeclik()
{
var elem = document.getElementById("tabsf").rows;
for(var i in elem)
{
alert(elem[i].id);
}
}
</script>
</head>
<body>
<table id="tabsf">
	<tbody>
		<tr id="tabsf_1"><td>1</td><td>2</td></tr>
		<tr id="tabsf_2"><td>3</td><td>4</td></tr>
		<tr id="tabsf_2"><td>5</td><td>6</td></tr>
		<tr id="tabsf_4"><td>7</td><td>8</td></tr>
		<tr id="tabsf_5"><td>9</td><td>10</td></tr>
	</tbody>
</table>
<input type="button" name="hach" value="click" onclick="cmeclik()" />
</body>
</html>

Answer : Get all rows in table in IE

Use a different varaiable in the using block:
I think you have the  code like this:

Dim i as integer

Using MyReader As   New  Microsoft.VisualBasic.FileIO.TextFieldParser("c:\myvbastext\listoffilesandpaths.txt")
             MyReader.TextFieldType =  Microsoft.VisualBasic.FileIO.FieldType.Delimited
             MyReader.Delimiters = New String() {","}
           Dim  currentRow  As String()
           While Not MyReader.EndOfData
                 currentRow = MyReader.ReadFields()
               i += 1
                 Nicknam(i) = currentRow(0)
                NameOfFile(i) =  currentRow(1)
               PathOfFile(i) =  currentRow(2)
                ExtensionOfFile(i) = currentRow(3)
                 LengthOfRecords(i) = currentRow(4)
           End  While
        End Using

So you can do like this:

Dim i as  integer

 
Using MyReader As  New  Microsoft.VisualBasic.FileIO.TextFieldParser("c:\myvbastext\listoffilesandpaths.txt")
           Dim j as integer = 0
             MyReader.TextFieldType =  Microsoft.VisualBasic.FileIO.FieldType.Delimited
             MyReader.Delimiters = New String() {","}
           Dim  currentRow  As String()
           While Not MyReader.EndOfData
                 currentRow = MyReader.ReadFields()
               j += 1
                 Nicknam(i) = currentRow(0)
                NameOfFile(i) =  currentRow(1)
               PathOfFile(i) =  currentRow(2)
                ExtensionOfFile(i) = currentRow(3)
                 LengthOfRecords(i) = currentRow(4)
           End  While
        End Using
...................
.................  'i' is accessible here as well so 'j' is a seperate variable you are using within 'using' block.
 ....................
....................
....................

 Since variable 'i'  is using inside the 'using' block and outside the  'using' block as well  so it is hiding the value within the 'using'  block.

Random Solutions  
 
programming4us programming4us