Forum Moderators: open
var test = document.createTextNode("this is a test");var eval_js = document.createElement('script');
eval_js.setAttribute('language', 'javascript');
eval_js.setAttribute('type', 'text/javascript');
eval_js.setAttribute('src', 'javascript/eval.js');
function include() {
var html_doc = document.getElementById ('javascript');
html_doc.appendChild(eval_js);
html_doc.appendChild(test);
return false;
}
function remove() {
var html_doc = document.getElementById ('javascript');
html_doc.removeChild(eval_js);
html_doc.removeChild(test);
return false;
}
I check the box and it loads the javascript checks fine and I get my alerts for what I need to fill out. If I uncheck it, I cant get the alerts to go away, they are still active.
Thanks,
Dennis
I don't think that I have ever tried to remove a reference to an external js file before. Now, having tried it using a 'swapper' function, I find that the functions persist even if you remove the reference to the js file.
One possible solution would be to null out each function that was contained in the js file that you want to remove. I have tried this in FF/Moz as well as IE6 and it seems to work.
If you have a function in js1.js called 'myfunc1' you can remove it by removing the reference to the external file and then running the following code:
myfunc1=null
Maybe not quite what you are looking for, but perhaps it will do for now...
ajkimoto
My error checking is done through a class and a variable so I'm going to try to clear that variable out and see if that works when the box is unchecked. I'll let you know.
Thanks,
Dennis