Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove Element from page 1

Status
Not open for further replies.

y2k1981

Programmer
Aug 2, 2002
773
IE
Is there any way to remove an element from a page? I have an IFRAME which calls a PHP script that changes a MySQL table to change the status of a record from open to closed. However, I need to remove a div from the parent page. I've been trying a simple one that says:
Code:
function removeMe()
{
var getOut = document.getElementById("id1");
getOut.removeElement;

}
But it doesn't work. Can anybody help me out? I don't want to just make the div hidden, I want to remove it from the page so that it doesn't take up room
 
Code:
function removeMe()
{
var getOut = document.getElementById("id1");
getOut.parentNode.removeNode(getOut)

}

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook

 
that's removing everything from the page !! here's my code
Code:
function remove()
{

var getOut = document.getElementById("id1");
getOut.parentNode.removeNode(getOut);

}


</script>
</head>


<body>
<a href="JavaScript:onClick=remove()">click here</a>
<div id="id1">this is the first div</div>
<div id="id2">this is the second div</div>
</body>
</html>

As soon as I click the link, both the divs and the anchor are removed.
 
Does this do it?

Code:
function removeMe()
{
var getOut = document.getElementById("id1");
[blue]getOut.removeNode()[/blue]

}

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook

 
no but this did:
Code:
function removeMe()
{
var getOut = document.getElementById("id1");
getOut.removeNode([COLOR=blue]getOut[/color])

}
 
Knew it was something like that.

Glad you figured it out.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook

 
Thanks for all your help, another well earned star
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top