its my code for printing array of buttons with values R and B but i m not getting the output..
first of all i want to askk can we use random method in value field of button i,e value="<%=Math.floor(Math.random() * ('R','B'))%>" if no then is there any other way to do it so that my array get filled with this two values R and B randomly....

<%!int i;
    int j;
    int count = 1;
      %>
    <div id="myDiv" style="color: red"></div>
    <%

        for (i = 1; i <= 9; i++) {
            for (j = 1; j <= 9; j++) {

    %>
    <input type="hidden" value="<%=count%>" id="hidden">
    <input type="button" style="width: 50px; height: 50px" value="<%=Math.floor(Math.random() * ('R','B'))%>"
        name="<%=count%>" onclick="countAdjacent(this.value,<%=count%>)">

    <%


                count++;
                        }            

    %>


    <br></br>
    <%
                }
        %>

why not use servlets? having java code in your jsp files seems handy at first, but it's a sure street to what is referred to as 'spaghetti-code'

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.