Click to See Complete Forum and Search --> : how set focus in cell of a table


mamtesh
12-22-2005, 01:36 AM
Dear All,

I have made table with onw row and two column with in DIV. What i want to set the focus in TD on typing these two character 'th' in text box. This DIV first is hidden, on typing 'th' in text box , it will visible and focus go to TD.

Please help out

Mamtesh

deep.dhyani
12-22-2005, 02:04 AM
<html>
<head>
<script Language="javascript">
function read_val(){
t_box=document.getElementById("t1");
if(t_box.value=="th"){
document.getElementById("tbl").style.display="inline";
document.getElementById("td1").focus();
}
}
window.setInterval("read_val()",100);

</script>
<Body>
<input type="text" name="t1" id="t1" value=""><br><br>

<table cellspacing="0" cellpadding="0" border='1' width="300" align="center" style="display:none" id="tbl" id="tbl" bordercolor=black>
<tr>
<td><input type="text" name="td1" id="td1"></td><td><input type="text" name="td1" id="td1"></td>
</tr>
</table>
</Body>
</head>
</html>