Home >Web Front-end >JS Tutorial >How to dynamically delete javascript functions_javascript skills
I now pass the following: o = odom.createelement ("script");
o.text = document.all.checkrule.value;
oiduom.body.appendchild (o);
Add a checkrule function,
But if I execute this code multiple times, the checkrule function will be inserted multiple times. How can I delete the new function first?
ps: oDOM represents the document object of another page. , not the document of this page, so using typeof(oDOM.check_rule) is always undefined
oDOM.frames.check_rule = null
The function with the same name will be overwritten.
You add an ID or NAME to the newly added SCRIPT, and then you can use the ID or NAME when deleting it
But remember, you must set the ID or NAME in the createElement method
For example: o = document.createElement("
, but you cannot get the object through the following statement var elem=oDOM.getElementById("checkid");, right?