hello , I need to alert the value entered in the text box,which is in TD cell, using DOM
can any one tell how please
here is the code with out a text box which is working
here is what i need
but i can't see the output if anything wromg please tell me
thanks
Swetha
can any one tell how please
here is the code with out a text box which is working
Code:
<html>
<head>
<script type="text/javascript">
function cell()
{
var x=document.getElementById('myTable').rows[0].cells;
alert(x[0].innerHTML);
}
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
<tr>
<td>cell 3</td>
<td>cell 4</td>
</tr>
</table>
<br />
<input type="button" onclick="cell()" value="Alert first cell">
</body>
</html>
Code:
<html>
<head>
<script type="text/javascript">
function cell()
{
var x=document.getElementById('myTable').rows[0].cells;
alert(x[1].firstChild.Value);
}
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>cell 1</td>
<td><input type="text" id="txt"></td>
</tr>
<tr>
<td>cell 3</td>
<td>cell 4</td>
</tr>
</table>
<br />
<input type="button" onclick="cell()" value="Alert first cell">
</body>
</html>
thanks
Swetha
Comment