just a quickie with javaScript - DOM implementation
just a quickie with javaScript - DOM implementation
- Subject: just a quickie with javaScript - DOM implementation
- From: "Daniel O'Sullivan" <email@hidden>
- Date: Thu, 17 Feb 2005 21:58:17 +0000
I'm trying to implement a function that will remove the child node "Buddy"
within the node "mario" using DOM implemenatation.
I'm unable to remove the node, can anybody help?!?
The final objective is allow any childnode within the "mario" to be deleted!
Thanks for listening guys!!
Danny O
<html>
<body>
<script type="text/javascript">
var count =0;
function insertP(form){
if (eval("document.form.q0[0].checked") == true)
{
var theNewParagraph = document.createElement('p');
var theTextOfTheParagraph = document.createTextNode(form.textEntry.value);
theNewParagraph.appendChild(theTextOfTheParagraph);
document.getElementById('mario').appendChild(theNewParagraph);
}
}
function deleteP(form){
if (eval("document.form.q0[1].checked") == true)
{
myDocumentElement = document.getElementById("mario");
myBody = document.getElementById("buddy");
removed = myDocumentElement.removeChild(mybody);
}
}
</script>
<form name = form>
<br>Please enter text to append on new paragraphs: <input type=text
name=textEntry value=textInput>
<br>
add<INPUT TYPE="RADIO" NAME="q0">
delete<INPUT TYPE="RADIO" NAME="q0">
insert<INPUT TYPE="RADIO" NAME="q0">
<br>
<br>----------------------------------------------------------------------------------------------------------------------
<br><input type=button name=add value="Lets rock"
onClick="insertP(this.form)"; deleteP(this.form)>
<br>----------------------------------------------------------------------------------------------------------------------
<p id ="mario">marios paragraph<p id ="buddy"> node</p>
</form>
</body>
</html>
_________________________________________________________________
Want to block unwanted pop-ups? Download the free MSN Toolbar now!
http://toolbar.msn.co.uk/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden