/    Sign up×
Community /Pin to ProfileBookmark

Dave its very urgent pls help…

<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>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@RibeyedJan 30.2003 — hi, ran this code never got an error, so whats your question?
Copy linkTweet thisAlerts:
@saju_mauthorJan 30.2003 — 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
×

Success!

Help @saju_m spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...