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 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









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 Parameters - JSP-Servlet
Passing Parameters  Hi I have to pass parameter like... Enter Email id... name is Email id
Advertisements
Passing Parameter - JSP-Servlet
Passing Parameter  I would like to ask how to pass a parameter from javascript section into the jsp section.It will be something like...; answer<%; <---I'm stuck here passing the var
passing parameters - JSP-Servlet
passing parameters  hi this is my jsp page Reserved By: Conference Hall No: Select Hall Numbers
Passing Parameter - JSP-Servlet
Passing Parameter  Hi, it'me again. Below is the set of code that I get from your solution entitled droplist that read from database. It do read from database but in the textbox of the webpage, i need it to show something
passing values - JSP-Servlet
passing values  hi this is my jsp page Reserved By: Conference Hall No: Select Hall Numbers Time Slot: Select Time Slot Date
Passing value in hyperlink - JSP-Servlet
Passing value in hyperlink  How to pass value in anchor tag or HTML...="0"><tr><td width="100%"><form method="...;<td width="50%" valign="right"><b>User ID<
passing the form values with image upload - JSP-Servlet
passing the form values with image upload  Hii . I want to get the solution for passing values with an image uploading form. I cant access... : 2. Enter value for field 2: 3. Upload file : and in your servlet you can
passing from 1 jsp to another - JSP-Servlet
passing from 1 jsp to another  Hi Sir, What are the ways and means of passing from 1 jsp page to another page.what are the different types of methods?  Hi Friend, You can use tag,sedRedirect() method
passing value from javascript to jsp - JSP-Servlet
passing value from javascript to jsp  Hi... Is there any way to get the value from the javascript and print it on the current jsp page or print an array onto the current jsp page using javascript  Hi Friend, We
passing value fron script to scriplet - JSP-Servlet
passing value fron script to scriplet  how to pass value from Java script to Scriplet in jsp  Hi friend, if you want to pass something from the client (javaScript) to the server (java), you have to submit a form
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
Usage of Session Id in servlet - Servlet Interview Questions
Usage of Session Id in servlet   Hi friends, I am beginner in servlets, without session Id can we do any operations like add,update,edit,delete. I saw Session id is loaded for edit and delete action not for add
Parameter passing from jsp page to jsp page - JSP-Servlet
Parameter passing from jsp page to jsp page  Hi I intends to pass the parameters that I received from previous page through query String. I get all parameter in respective string variables. I have to passed the parameters
Need to expand tree by passing Id thr URL. (not by clicking manually) - Java Server Faces Questions
Need to expand tree by passing Id thr URL. (not by clicking manually)  Sub: Need to expand tree by passing Id thr URL. Hi, Here i have...=tree&albumIds=1001,1002,1005,1008,1009,1010&client=0" I m passing album Ids
Need to expand tree by passing Id thr URL. - Java Server Faces Questions
Need to expand tree by passing Id thr URL.  Hi, Here i have...=tree&albumIds=1001,1002,1005,1008,1009,1010&client=0" I m passing album Ids... by passing the clientId from Url. How can I do it. Plz help asap
How to get an Id vaue - JSP-Servlet
How to get an Id vaue  Dear Sir, Thanks for posting... or delete etc button i have to go that page and i want that selected id value... In form action their is a servlet action when i clickon a button
Maven Repository/Dependency: com.treasuredata | td-client
Maven Repository/Dependency of Group ID com.treasuredata and Artifact ID td-client. Latest version of com.treasuredata:td-client dependencies. # Version Release Date 1 0.5.4
Maven Repository/Dependency: com.treasuredata | td-jdbc
Maven Repository/Dependency of Group ID com.treasuredata and Artifact ID td-jdbc. Latest version of com.treasuredata:td-jdbc dependencies. # Version Release Date 1 0.5.11
Maven Repository/Dependency: com.smartydroid | support-ui-cell
Maven Repository/Dependency of Group ID com.smartydroid and Artifact ID support-ui-cell. Latest version of com.smartydroid:support-ui-cell dependencies. # Version Release Date You can
Validate Domain of an Email Id - JSP-Servlet
Validate Domain of an Email Id  How to validate the domain name in an Email id before sending a mail for an application using Mail API. ex: [email protected] in the above email id i want to validate whether a.com is present
How to get an Id vaue - JSP-Servlet
How to get an Id vaue  Dear Sir , How to get an Id value of a column when it is select ,i have to get an perticular rows Id value .I have a table with attributes like select,Id,subject,matter,status...If i select a one
Validating Emp ID Reply - JSP-Servlet
Validating Emp ID Reply  Respected Sir/Madam, I am Ragavendran.R.. Thanks for your quick response.. Actually I need to check whether Emp ID...("Employee ID cannot be null"); form.id.focus(); return false; } if(form.name.value
Maven Repository/Dependency: com.treasuredata | td-logger-parent
Maven Repository/Dependency of Group ID com.treasuredata and Artifact ID td-logger-parent. Latest version of com.treasuredata:td-logger-parent dependencies. # Version Release Date 1
differences between cell spacing and cell padding
differences between cell spacing and cell padding  What are the differences between cell spacing and cell padding
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
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...;table> <tr> <td style="padding-right:10px">data</td> <
Passing variable
Passing variable  How to pass variable to HTTP object in HTMl or PHP
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
Maven Repository/Dependency: com.teradata | redlinerpm-maven-plugin-td
Maven Repository/Dependency of Group ID com.teradata and Artifact ID redlinerpm-maven-plugin-td. Latest version of com.teradata:redlinerpm-maven-plugin-td dependencies. # Version Release Date
Maven Repository/Dependency: com.treasuredata | td-android-sdk
Maven Repository/Dependency of Group ID com.treasuredata and Artifact ID td-android-sdk. Latest version of com.treasuredata:td-android-sdk dependencies. # Version Release Date 1
change content of cell javascript
change content of cell javascript  change content of cell javascript
Custom Cell View UITableview
Custom Cell View UITableview  How can i get two custom cell view in UITableView
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
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
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
editing cell in a table - JDBC
editing cell in a table  how can i edit a cell in a table and save the change to a database  Hi Friend, Try the following code: 1)updateDatabase.jsp RollNo Name Class "> "> ">
ModuleNotFoundError: No module named 'td'
ModuleNotFoundError: No module named 'td'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'td' How to remove the ModuleNotFoundError: No module named 'td' error
ModuleNotFoundError: No module named 'td'
ModuleNotFoundError: No module named 'td'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'td' How to remove the ModuleNotFoundError: No module named 'td' error
Height for cell in table view - UITableView
Height for cell in table view - UITableView  UITableview height for cell What is the height for cell in table view iPhone mobile application
id
id  how to find date of birth and gender in id in html with the help of javascript
Passing array element
Passing array element  What about passing an element of an array? If I have array of objects and pass functionA(arr[2]); Then functionA() will get arr[2] as a value type or a reference type
Java parameter passing
Java parameter passing  What type of parameter passing does Java support
percentage values for <TD WIDTH=...>
percentage values for   Can I use percentage values for <TD WIDTH=...>
Display of value in Tabel cell
in the table cell by defining the cell editor.The cell is having a text field and calendar.When i select a date in the calendar the date will be displayed in the cell...) The format the cell is showing when its in focus - Mon,dd,yyyy(Mar,01,2011). I
html input passing to jsp method
html input passing to jsp method  i want code in which jsp method..." name="userId" id="userId" /></td> </tr> <tr> <td>Password</td> <td><input type="password" id
image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls
image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls
image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls
image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls

Ads