View Full Version : Resolved Array Element Values

05-13-2009, 06:33 PM
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?! :confused:

05-13-2009, 11:12 PM
I need to see the whole code.
When pasting a code, please remember to use [code] tags. That includes [ html ], [ code ], and [ php ].

05-14-2009, 01:26 PM
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:

... 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.