removeObjectByID
This function will remove the object from the page. Note
this function will remove the element rather than hide it. Any further scripts
or calls to the targeted div will cause an error since it no longer exists.
Try this function
This is targetDiv1
This is targetDiv2
Requirements
Insert the following into the <head> element.
- <script src="scripts/screenEffects.js"></script>
Syntax
This function is called with the following line: removeObjectByID(myID);
Arguments
- myID is the id attribute of the target object, in single quotes.
Implementation Steps
- Make sure correct .js files (listed above) are imported in the <head>
element.
- Give the target element an id
- Insert correct function call such as onmousedown="javascript:removeObjectByID(myID);"
- Change myID to the id you gave to target element, in single quotes.
The Code
function removeObjectByID(myID)
{
removeObject(document.getElementById(myID));
}