Click to See Complete Forum and Search --> : showing a loop inside a div...


listenmirndt
09-05-2008, 09:12 AM
stringy = "~1~~12~~13~";
mySplitResult = stringy.split("~");
for(i = 0; i < mySplitResult.length; i++){
document.getElementById('elmID').innerHTML("----" + mySplitResult[i] + " (Remove)" );

<div id=elmID></div>


So, when this runs, it prints : ---- inside of the div,

but i think it should be printing :
----1 (Remove)----12 (Remove)----13 (Remove)

Thats what I need anyway,

Any help would be much appreciated!

Weedpacket
09-06-2008, 12:22 AM
innerHTML (http://developer.mozilla.org/index.php?title=En/DOM/Element.innerHTML) is not a method, it's a string. Try using it like one.