Hi, I just started javascript.
I want to put a radio button into an array I have done this so far:
var blocks = new Array("<input type="radio" name="" value="1">","2","3","4","5","6","7","8","9");
however this isn't working.
I suspect that I need to change the 'mode' to html somehow?

<html>
<head></head>
<script type="text/javascript">

// setup
var blocks = new Array("<html><input type="radio" name="" value="1"></html>","2","3","4","5","6","7","8","9");
var board = new Array("["+blocks[0]+"]","["+blocks[1]+"]",
                      "["+blocks[2]+"] <br />",
                      "["+blocks[3]+"]","["+blocks[4]+"]",
                      "["+blocks[5]+"] <br />",
                      "["+blocks[6]+"]","["+blocks[7]+"]",
                      "["+blocks[8]+"]");

// functions
function writeboard(blocks,board){
    for(i=0;i<9;i++){
        document.write(board[i]);
    }
}

//main
writeboard(blocks,board);
</script>
<body>
<form>
<input type="text" name="input">
</form>
</body>
</html>

Man, I have no idea of what you trying to do. Your code doesn't make any sense to me.
You want to have an array and create radio buttons, is that it? I mean, if there 10 itens in the array you want 10 radio buttons?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.