Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Dec 2008
    Posts
    58
    Thanks
    18
    Thanked 1 Time in 1 Post

    Need help with a For/In statement

    Hey guys, here's my code in question:
    Code:
    for (x in magicName) {
    	document.getElementById('statuspane').innerHTML = "<div id='magic"+[x]+"'></div>";
    	document.getElementById('magic')[x].innerHTML = "<p>"+
    		"<strong>"+magicName[x]+"</strong></p>";
    }
    What I'm trying to do here is create a magic[x] div inside "statuspane" for each x there is in magicName. This part works fine.

    However, after it makes those divs, I want to access each one and put more content into them. I'm having a little trouble figuring out how to do that, though.

    Can anyone help me out? Is what I'm trying to do even possible? (Fairly confident it is, though, and I'm just doing something silly)


    // EDIT //
    Nevermind I solved it!
    Last edited by TheTot; 01-30-2009 at 04:09 AM.


 

Posting Permissions

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