I can't see your code so the best I can tell you is the simplest solution. Put your Javascript in the body section in a div and if once the code is executed use Javascript or PHP to change the divs contents to empty.
You would want to use a regular expression to strip <script></script> tags. You should be able to find the regex here: http://stackoverflow.com/questions/...ion-to-remove-a-given-xhtml-tag-from-a-string
All you do is replace <script and </script> with a fake name like 'hidescript' so then it will not run the commands. Just use this: