Hi,
I am trying to write code that will insert HTML into an empty <span>
tag. The function that will do this is add_item(), which works OK
where the code is inserted using the innerHTML command/method. The
problem occurs when i want to overwrite the code using a similar
function. it doesnt seem to do anything let alone overwrite. below is
a stripped down version of what i am tryin to achieve:
<html>
<head>
<script>
function add_item() {
item1.innerHTML = '<p>Insertion</p>';
}
function delete_item() {
item1.innerHTML = '<p>Insertion now overwritten</p>';
}
</script>
</head>
<body>
<span onClick="add_item()">Click here to insert</span><br><br>
<span onClick="delete_item()">Click here to delete</span><br><br>
<span id="item1"></span>
</body>
</html>
if anybody could tell me why it doesnt overwrite or another approach i
should try it would be much appreciated. thanks
burnsy