Click to See Complete Forum and Search --> : Dave its very urgent pls help...


saju_m
01-30-2003, 05:36 AM
<HTML>
<HEAD>
<SCRIPT>
var st=-1;
var tblOldCells = new Array(10);
function createText()
{

if(st!=-1)
{
var tblCells = document.getElementById("tid").rows[st].cells;
var j, len = tblCells.length;
for (j=0; j<len; j++)
{
tblCells[j].innerText = tblOldCells[j];
}
st = -1;
}

var t = event.srcElement;

st = t.parentElement.rowIndex;
var tblCells = document.getElementById("tid").rows[t.parentElement.rowIndex].cells;



var j, len = tblCells.length;


for (j=0; j<len; j++)
{

var oNewItem = document.createElement("input");
oNewItem.value=tblCells[j].innerText;
tblCells[j].innerText="";
tblCells[j].insertBefore(oNewItem);
tblOldCells[j] = oNewItem.value;
}


}
</SCRIPT>
</HEAD>
<BODY >
<table id="tid" border = "1" >
<tr onclick="createText()">
<td id="td1">Italy</td>
<td id="td2">UK</td>
<td id="td3">Spain</td>

</tr>
<tr onclick="createText()">
<td id="td4">USA</td>
<td id="td5" >Canada</td>
<td id="td6" >Mexico</td>

</tr>
<tr onclick="createText()">
<td id="td4">India</td>
<td id="td5" >China</td>
<td id="td6" >Japan</td>
<td id="td6" >Korea</td>
</tr>
</table>

<BODY>
</HTML>

Ribeyed
01-30-2003, 06:17 AM
hi, ran this code never got an error, so whats your question?

saju_m
01-30-2003, 06:38 AM
hi boss...sorry my question was...

the javascript which i attached uses createElement(created textboxes),
can u help me in creating a whole row( i mean row of 3 cells with one textbox each) using createElement(i'll create it only once). so that when i click on a row of a table that row should be replaced by the row object which i kept created already.

reference the code i attached ih the earlier

pls help

else pls give me someother suggestions

ran.m