Jump to content
php.lv forumi
  • 0

Javascrip nedzēš pareizo tabulas līniju


Question

Posted (edited)

function delrow(r,table) {
var i=r.parentNode.parentNode.rowIndex;
document.getElementById(table).deleteRow(i);
}

 

<tr><td><a href="del" onclick="delrow(this,'comment_list'); return false;">Dzēst</a></td></tr>

 

Kaut kas nav kārtība? Laikam this atsaucās uz <a> tāgu? Dzēst dzēš ,bet pašu augšējo!

Edited by Wuu

1 answer to this question

Recommended Posts

  • 0
Posted

hz, itkā strādā, kā vajag :>

<script type="text/javascript">
function delrow(r,table) {
       var i=r.parentNode.parentNode.rowIndex;
       document.getElementById(table).deleteRow(i);
}
</script>
<table id="comment_list">
<tr><td><a href="del" onclick="delrow(this,'comment_list'); return false;">Dzēst1</a></td></tr>
<tr><td><a href="del" onclick="delrow(this,'comment_list'); return false;">Dzēst2</a></td></tr>
<tr><td><a href="del" onclick="delrow(this,'comment_list'); return false;">Dzēst3</a></td></tr>
<tr><td><a href="del" onclick="delrow(this,'comment_list'); return false;">Dzēst4</a></td></tr>
</table>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...