Passing td cell id to servlet

Ads
 

Passing td cell id to servlet

Hi all,

I am new to JSP/Servlet .Please help. I need to send the table cell index in servlet using javascript and should be able to make a cell index to have a text - "X" / "0"only once.

Here is my code sofar-

    function editTableCell(e)
    {
var player1=true;
var player2=true;
         var CellText = null;
         alert(e);
         var SelectedElement = document.getElementById(e);
         alert(SelectedElement);
         if(player1)
             {
           //e.innerHTML="X";
            SelectedElement.innerHTML = "X";
            //CellText = SelectedElement.innerHTML;   
             }
         else{
             SelectedElement = e;
                e.innerHTML = "0";
                CellText = e.innerHTML;
         }


    }

</script>
<style type="text/css">
body{
    text-align: center;
}
table{
    text-align: center;
    table-layout:fixed;
}
</style>
</head>

<body>
<div>
<form method="post" action="TicTacToeGame">
<table id="board" border=1 align=center cellpadding="2" cellspacing="3" width="250" height="250" >
<tr>
<td id="1" onClick="editTableCell(1)"></td>
<td id="2" onClick="editTableCell(2)"></td>
<td id="3" onClick="editTableCell(3)"> </td>
</tr>
<tr>
<td id="4" onClick="editTableCell(4)"></td>
<td id="5" onClick="editTableCell(5)"></td>
<td id="6" onClick="editTableCell(6)"> </td>
</tr>
<tr>
<td id="7" onClick="editTableCell(7)"></td>
<td id="8" onClick="editTableCell(8)"></td>
<td id="9" onClick="editTableCell(9)"> </td>
</table>
 <div><input type="submit" value="Move" name="Submit"></div>
</form>
</div>
</body>
</html>
View Answers

Ads









Related Tutorials/Questions & Answers:
Passing td cell id to servlet
Passing td cell id to servlet  Hi all, I am new to JSP/Servlet .Please help. I need to send the table cell index in servlet using javascript...;td id="1" onClick="editTableCell(1)"></td> <td id="2" onClick
Passing java variables from JSP to Servlet - return null values
Passing java variables from JSP to Servlet - return null values  I want to pass some variables from a JSP page to a servlet. These variables are from... from JSP to servlet gives null values. I got msg=null. Is there another way
Advertisements
id
id  how to find date of birth and gender in id in html with the help of javascript
Passing classid or name in request using Jquery
Passing classid or name in request using Jquery  Hi, I am new to JQuery.I have a servlet that I am calling using jquery.I have some parameters like filename,userid that I am passing to the servlet to upload a file.I have created
Passing variable
Passing variable  How to pass variable to HTTP object in HTMl or PHP
css table cell margin
css table cell margin  How can i put margin between two columns(cell... this css into your td to set the margin between cells. See how you can include it in your code. <table> <tr> <td style="padding-right:10px">
SERVLET
and elete button,when user submit his/her user id then the value pass to the servlet and if the user id is correct then a new page will be displayed with his... pass to the servlet and all the fields brlongs to that id will be appear
Table Empty Cell in HTML
Table Empty Cell in HTML       The Table Empty Cell in HTML define no content inside a cell of table. The code is not able to display border around the empty cell in a table
servlet
com.ilp.tsi.pm.services.StockService; /** * Servlet implementation class AddServlet1 */ //Servlet for Adding the stock public class AddStockServlet extends... for passing control to add stock if(req.getParameter("add")!=null
change content of cell javascript
change content of cell javascript  change content of cell javascript
Argument Passing
Passing Argument in Java  hi this is my code class Test { void meth(int i, int j) { i *= 2; j /= 2; System.out.println("a=" +i); System.out.println("b=" +j); } } public
Servlet
Servlet  how to navigate one servlet page to another servlet page
Custom Cell View UITableview
Custom Cell View UITableview  How can i get two custom cell view in UITableView
servlet
servlet  is there any way to include pdf's in servlet
ModuleNotFoundError: No module named 'cell'
ModuleNotFoundError: No module named 'cell'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cell' How to remove the ModuleNotFoundError: No module named 'cell' error
servlet
servlet  what are the methods and interfaces in the servlet api ?   Servlet Tutorials
servlet
servlet  what are the all necessary configuration to run a servlet
servlet
servlet  how to interact with a servlet from a swing program
servlet
servlet  I designed 1 html form & a servlet but when I click on form I don't get output of servlet Please help
servlet
servlet  I designed 1 html form & a servlet but when I click on form I don't get output of servlet Please help
servlet
servlet  i want to create a login page with servlet using database mysql? only in servlet not in jsp plzz help me out
VoIP Cell Phone
, the InternetTalker recognizes the cell phone caller ID and immediately links the caller to the VoIP network. The InternetTalker can recognize up to three cell-ID... VoIP Cell Phone Using VoIP with Cell Phone  Before many
Servlet
override Service method in the servlet when you extend GenericServlet to create servlet as it is mandatory to override it. But, when you extend HttpServlet to create a servlet then you can't override service method as there is a need to override
servlet
servlet  i want a program for counting the no of times the servlet has been invoked
servlet
servlet  how to create a login form using servlet using submit,edit delete button
servlet
servlet  dear sir servlet and html not run on eclips plz help me
servlet
servlet  can i stoar record in variable which selected from table in servlet
servlet
of the Servlet API. It contains the classes necessary for a standard, protocol-independent servlet. Every servlet must implement the Servlet interface in one
Servlet
Servlet  I want to know the steps to write a simple servlet program... .   Hello Friend, Follow these steps: Put servlet-api.jar inside the lib folder of apache tomcat. 1)create a servlet. import java.io.*; import
Servlet
Servlet  Can a user defined function be included in a servlet? I need information regarding servlet syntax and not JSP.   Yes, you can create user defined function in Servlets. Have a look at the following link: http
servlet
servlet  I want the full coding for uploading a file in local drive D usin jsp,java class and servlet... help me thanks in advance....   ... and servlet please and thanks in advance

Ads