Click here to Skip to main content
16,016,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

i have few assistance in my below code developed by html formate,
which is have how to delete particular table row in html?

my concept flow is:

i have one text box , one button and finally one table were i display the text message,

1.whatever i have enter in text box it as comes to display my table and so and so the process going like this .
2. my douts is how do i delete particular table row where its displayed in the table.

please find out the below my code and tell me the suggestion or else give me a suitable code where i have stuck up the above douts,
i already tried so many ways but i cant get the exact output, so that i put my comments to here ,
please consider this mail...

my code is :


XML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

    <script type="text/javascript" language="javascript">
function addNewItem()
{
// Retrieve the elements from the document body
var textbox = document.getElementById('MyTextbox');
var listbox = document.getElementById('MyListbox');

// Now we need to create a new 'option' tag to add to MyListbox
var newOption = document.createElement('option');
newOption.value = textbox.value; // The value that this option will have
newOption.innerHTML = textbox.value; // The displayed text inside of the <option> tags

// Finally, add the new option to the listbox
listbox.appendChild(newOption);
document.getElementById("MyListbox").deleteRow(0);
}
    </script>


</head>
<body>
    <input id="MyTextbox" type="text" />
    <input type="button" value="Add Item" onclick="javascript:addNewItem()" />
    <br />
    <br />

    <table id="MyListbox">
        <tr>
           <td>
           </td>
        </tr>
    </table>

</body>
</html>




thanks to advance...
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900