In the Web page we have a table link, if we click on that
link all the contents under that link will be sorted
(asscending/Descending). Now i want to check in which order
the list is ? for that i need to get the data in to some var
How can i get that cells data?

Answer Posted / ganesh

To get data from table cells, u shld use innerHTML.
For that u need to give id's for all the TD's in the Table.
Try the below coding:

<script language="javascript">
function getdatas()
{
var data=document.getElementById('data6').innerHTML;
alert(data);
}
</script>
</head>

<body>
<table width="200" border="1">
<tr>
<td id="data1">ganesh</td>
<td id="data2">magesh</td>
<td id="data3">tanveer</td>
</tr>
<tr>
<td id="data4">satya</td>
<td id="data5">siddiq</td>
<td id="data6">bimal</td>
</tr>
<tr>
<td id="data7">jenson</td>
<td id="data8">nasrulla</td>
<td id="data9">dayanand</td>
</tr>
</table>
<input type="button" value="Get" onclick="getdatas()" />
</body>

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

why script is client dependant.

1795


Someone who protect my excel file, m using ms office 2007 and windows 7 operating system, pls help me, how can i unprotect sheet

1904


a="10.20.30.1" replace 1 with 45 in python using reg ex

987


I have deducted tds on pay slip for employees ist month tell me how to deposit this amt to govt. by bank or any form is available fill the same and deposit the govt. department. Pls explain me which form to be used for deposit the same with due date.

2857


why script is client dependant.

1985






If we add regular expressions to a script recorded in QTP, will it effect the performance of the script?

1772


We have 1 web page with names column. I am giving the Service Providers1,2,3.... @ that time dynamically some no of names are displaying in the webpage and The Pop up windows are opening(No.of Pop Up windows=No.of Names). The names may be diffar for each and every Service Provders (Dynamically) How can we handle the Dynamic values?

1629


Hi Guys, I am very new to QTP tool , In real time environment how to test the application with this tool, 1. How to load application in QTP tool 2. How to write test script in QTP. 3. In manual testing we test login box (user id , password) how can we test this kind of testing with QTP tool with examples . Please guys put some focus on my questions , real time ecperienced answers would be appreciate, advance thanks ,please guys i am expecting ur answers as soon as posible

1855


how can i get two different fonts in a single line

1567


I Am Planning to Write ISTQB foundation level Ceritification of inida. can Any Body let me know how to prepare for it & Any Study material can you provide or Any other E-books i should need to Study. Please Mail to me ajaybe_2004@yahoo.co.in THnaks in advance Ajay

1844


Need a batch file or VB script to delete old (more than 90datys) roaming profiles

1842


Why we use Action Script(Multimedia Flash) rather than using other scripting languages (JAVA,VB...etc) ?

2372


can I name the build.xml with any name? if so how can I invoke ?

2006


How applet differ from Swings in java ?

1585


what is the Structure of an ANT file?

1759