Share on Google+Share on Google+

navya j nair
Passing td cell id to servlet
0 Answer(s)      5 years ago
Posted in : JSP-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>

Ads

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<
percentage values for <TD WIDTH=...>
percentage values for   Can I use percentage values for <TD WIDTH=...>
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
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
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
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
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
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
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
id
id  how to find date of birth and gender in id in html with the help of javascript
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
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
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
differences between cell spacing and cell padding
differences between cell spacing and cell padding  What are the differences between cell spacing and cell padding
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">
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
Passing variable
Passing variable  How to pass variable to HTTP object in HTMl or PHP
change content of cell javascript
change content of cell javascript  change content of cell javascript
Session ID
Session ID  How can I change the session ID of the page?   The servlet session represents a relationship between the servlet container...' session ID values because it is very likely to result in the loss of the session
Custom Cell View UITableview
Custom Cell View UITableview  How can i get two custom cell view in UITableView
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
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 "> "> ">
Tutorials   
Java Spring Hibernate Struts Training fat image from db fat image from db fat image from db fat image from db unable to get value returned from javascript variable in page How to change image size before adding to mysql using jsp Design a registration.jsp page with input for user registration details Cart Quantity jsp servlet coding issue servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? image pdf marking pdf marking Multiple image upload using JSP Read code from excel sheet and upload into database using JSP Student java about search engine Convert BLOB to PDF and save it to a location how to copy files from remote to local machine using SFTP SSL in java? Like Team viewer Socket and Servert -Jsp how to copy files from remote location to local using java? How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java how to create SOAP based web service in java? how to fetch data from mysql database table and draw a bar chart on that data using in jsp how to create users in LDAP using java? how to authenticate user using TIVOLI api in java? how to create users using IBM Tivoi API in jsp/servelet? Java/J2ee Please explain this code as many packages and classes are unknown to me .! how to download the uploaded folder files using jsp Login Query image is display from path of mysql database please reply the code to store dynamic fields in database? Reloading issue in jsp How to get Button Id ? calling one jap page from another jsp page login login Problem to get connection from DAO class to JDBC Page Loading Time Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below Sending hidden values

Ads

 
Advertisement null

Ads