Results 1 to 3 of 3

Thread: Array Element Values

  1. #1
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Array Element Values

    I am trying to insert the value of an array element into a string, then display the string on screen...simple right?! (What I thought too until I tried it in FF).

    Here's the basic premise (simplified for posting):

    var title = tiptitlesA[tipId[x].firstChild.nodeValue].toString();
    var html = '<div id="tiptitle" style="text-decoration:underline;"><h3>' + title + '</h3></div>';

    document.getElementById(tgtDiv).innerHTML = html;


    This works fine in IE, but I cannot seem to get FF to output anything other than [object text]. Can someone please square me away with what I need to do about this?!
    Last edited by Snookerman; 05-14-2009 at 05:10 PM. Reason: added “Resolved” prefix

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I need to see the whole code.
    When pasting a code, please remember to use [code] tags. That includes [ html ], [ code ], and [ php ].
    Jeremy | jfein.net

  3. #3
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Solved !!

    I decided to litter my code with alert()s so that I could see what was happening to my data through the procedure....turns out that given what I had intended to do with the data, I did not need to execute:
    Code:
    ...
    ... document.createTextNode(tipTitle[x].firstChild.nodeValue);
    ...
    I needed the string value of "tipTitle[x].firstChild.nodeValue". From what I can tell, createTextNode was turning the string into an object, hence the [object text] output. If I were to append that to another DOM object with appendChild i *think* it would have worked as written.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •