[Greasemonkey] modify a javascript array

John gm at plsek.id.au
Tue Jul 5 15:03:31 EDT 2005


Tobias Orterer wrote:

>ok, now its driving me crazy...
>
>if( bar > 0 ) span[i].firstChild.nodeValue += 'B:' + bar;
>if( ( bar> 0 ) && ( foo> 0 ) ) {
>	span[i].appendChild( document.createElement( "br" ) );
>}
>if( foo > 0 ) span[i].firstChild.nodeValue += 'F:' + foo;
>
>why is the <br> not between the text?!?
>
>sorry, i am shure getting on someones nerves...
>
>
>
>O
>
Because you are adding "B:" and "F:" to the spans firstChild (being the 
text node), and the appended <BR> is the spans SECOND child, and 
therefore AFTER both the B: and F: strings

John


More information about the Greasemonkey mailing list