eval() problem in Firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • reazrana
    New Member
    • Oct 2007
    • 6

    eval() problem in Firefox

    hello,

    i hv some probs with eval() in firefox. it works in IE nicely.
    here is the code.
    [PHP]eval("document. getElementById( '" + tblName + "').rows[0].cells[" + cellNo + "].innerHTML = document.getEle mentById('seat_ " + seatNo + "').innenTe xt" ); //innerText[/PHP]

    any soluation??
  • reazrana
    New Member
    • Oct 2007
    • 6

    #2
    wow i got the solution..


    [CODE=javascript]eval("document. getElementById( '" + tblName + "').rows[0].cells[" + cellNo + "].innerHTML = document.getEle mentById('seat_ " + seatNo + "').textContent " ); //innerText[/CODE]
    Last edited by gits; Oct 2 '07, 10:52 AM. Reason: added code tags

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5388

      #3
      hi ...

      welcome to TSDN ...

      why do you use eval at all? in a 'regular' script there should never be a need for eval ...

      [CODE=javascript]document.getEle mentById(tblNam e).rows[0].cells[cellNo].innerHTML = document.getEle mentById('seat_ ' + seatNo).textCon tent
      [/CODE]
      should work fine?

      kind regards

      PS: FF/Mozilla has no innerText ...

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        Specifically, innerText is not standard.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Originally posted by drhowarddrfine
          Specifically, innerText is not standard.
          Neither is innerHTML, but it's supported by probably all browsers.

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #6
            the standards way probably would be to create/retrieve the entire node-hierarchy including textnodes etc. to append, replace, remove children out of the document tree and use regular dom-methods for that ... innerHTML sometimes shortens this way ... even when it is not the standard :) and i'm with acoder - i think all browsers support it ...

            kind regards

            Comment

            • mscir
              New Member
              • Nov 2007
              • 1

              #7
              Hi,

              I have some obfuscated javascript that runs in IE 6 and 7 but not Firefox.

              Does Firefox support eval?

              Is there a reliable cross-brower way to use obfuscated javascript? I know it's not recommended but that's what I've been asked to provide.

              Thanks,
              Mike

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Originally posted by mscir
                Does Firefox support eval?
                It most certainly does.

                Can you post the code that you're using?

                Comment

                Working...