Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
This is my JavaScript code:
C#
function selectRow(objTR)
{
    for (i = 0; i < ddlModalityList.options.length; i++)
    {
        if (ddlModalityList.options[i].text == objTR.cells[1].innerText.trim())
            break;
    }

    ddlModalityList.options[i].selected = true;
    txtSSAETitle.value = objTR.cells[2].innerText.trim();
    txtSSName.value = objTR.cells[3].innerText.trim();
}
This is repeater code. On row click I am passing id of tr and displaying respective td value in respective dropdownlist and textboxes. This code works fine in IE but fails in Mozilla Firefox.
XML
<tr onclick="selectRow(this);">
    <td class="csstablelisttd" style="display: none;" >
        <%#Eval("Acq_Modality_ID")%>
    </td>
    <td class="csstablelisttd" >
        <asp:Label ID="lblModality" runat="server" Text='<%#Eval("Modality")%>'></asp:Label>
    </td>

    <td class="csstablelisttd">
        <asp:Label ID="lblSchdledStAETitle" runat="server" Text='<%#Eval("Scheduled_Station_AE_Title")%>'></asp:Label>
    </td>
    <td class="csstablelisttd">
        <asp:Label ID="lblSchdleStationAEName" runat="server" Text='<%#Eval("SCHEDULED_STATION_NAME")%>'></asp:Label>
    </td>
</tr

>
Posted

1 solution

innerText is an *OLD* Internet Explorer-only non-standard element property. textContent is the current standard property, and works in all browsers with more than one brain cell. If you *really* need to, you can write conditional code to use whichever one works. (Google 'innerText' for some examples.)

Peter
 
Share this answer
 
Comments
DominicZA 3-May-12 7:50am    
Gah...you beat me to it :P 5 stars...
Peter_in_2780 3-May-12 8:02am    
I've answered this one twice recently. Would you like to take over for, say, the next month? :)
DominicZA 3-May-12 8:19am    
Lol...can you imagine a world of programmers that used Google??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900