'Innertext' to write in a table cell generated through HTML doesn't work in firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prawasini
    New Member
    • Oct 2007
    • 1

    'Innertext' to write in a table cell generated through HTML doesn't work in firefox

    hi,

    I have a code where a value in one of a table cell needs to be populated on a command button click event.
    Scenario:
    There is a main window having multiple <DIV>s In one of the Div there is a table havind ID on a concerned cell (initially blank). The div also has a command button.
    Now once the button is cliked, a popup window should open and the concerned cell (present in the main window) should be populated with a value.

    code to write the text in the parent window cell:
    [code=javascript]
    document.getEle mentById('Quest CostofCapital') .innerText = <%=TempCostofCa pital%>[/code]
    the variable TempCostofCapit al has a proper value. I have verified thru alert().
    This code works fine in IE but not in FireFox. i.e it populates the cell in IE bt leave the same in FireFox without any error.

    Kindly provide me the solution.

    prawasini
    Last edited by pbmods; Oct 6 '07, 02:29 PM. Reason: Added CODE tags.
  • Eyeinstyin
    New Member
    • Sep 2007
    • 20

    #2
    Originally posted by prawasini
    hi,

    I have a code where a value in one of a table cell needs to be populated on a command button click event.
    Scenario:
    There is a main window having multiple <DIV>s In one of the Div there is a table havind ID on a concerned cell (initially blank). The div also has a command button.
    Now once the button is cliked, a popup window should open and the concerned cell (present in the main window) should be populated with a value.

    code to write the text in the parent window cell:

    document.getEle mentById('Quest CostofCapital') .innerText = <%=TempCostofCa pital%>
    the variable TempCostofCapit al has a proper value. I have verified thru alert().
    This code works fine in IE but not in FireFox. i.e it populates the cell in IE bt leave the same in FireFox without any error.

    Kindly provide me the solution.

    prawasini
    try innerHTML instead of innerText
    [code=javascript]
    document.getEle mentById('Quest CostofCapital') .innerHTML = <%=TempCostofCa pital%>[/code]
    Last edited by pbmods; Oct 6 '07, 02:29 PM. Reason: Added CODE tags.

    Comment

    • FullyH3ktik
      New Member
      • Sep 2007
      • 52

      #3
      have you tried using innerHTML instead of innerText?
      because if it's working in IE but not in FF, you must have something wrong with your code

      Comment

      • Eyeinstyin
        New Member
        • Sep 2007
        • 20

        #4
        Originally posted by FullyH3ktik
        have you tried using innerHTML instead of innerText?
        because if it's working in IE but not in FF, you must have something wrong with your code
        Try using innerText with mozilla It won't work but replace with innerHTML it would work

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          prawasini, Eyeinstyin:
          Please use CODE tags when posting source code:

          &#91;CODE=javas cript]
          JavaScript code goes here.
          &#91;/CODE]

          Comment

          • reazrana
            New Member
            • Oct 2007
            • 6

            #6
            Originally posted by prawasini
            hi,

            I have a code where a value in one of a table cell needs to be populated on a command button click event.
            Scenario:
            There is a main window having multiple <DIV>s In one of the Div there is a table havind ID on a concerned cell (initially blank). The div also has a command button.
            Now once the button is cliked, a popup window should open and the concerned cell (present in the main window) should be populated with a value.

            code to write the text in the parent window cell:
            [code=javascript]
            document.getEle mentById('Quest CostofCapital') .innerText = <%=TempCostofCa pital%>[/code]
            the variable TempCostofCapit al has a proper value. I have verified thru alert().
            This code works fine in IE but not in FireFox. i.e it populates the cell in IE bt leave the same in FireFox without any error.

            Kindly provide me the solution.

            prawasini


            use textContent for innerText in FireFox

            Comment

            Working...