0

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>
    <%
                }
        %>
2
Contributors
1
Reply
18
Views
4 Years
Discussion Span
Last Post by stultuske
0

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'

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.