How can I remove all scripts from a document using MSHTML?

   I have an HTML document loaded in to a mshtml.IHTMLDocument2 class. I would like to remove all javascript (and vb script) from the document. I can remove all script BLOCKS using the HTMLDocument.scripts collection, that works great for removing <script> blocks, but inline script like the following remain.

<SELECT onchange="location =">

How can I remove all onSomeEvent functions from every element in the document?
Is there anyway to access a collection of the element event scripts?

Thanks in advance... and if possible I would really like a solution that does not traverse all the elements in the document.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

mailBoy2Connect With a Mentor Commented:
Use document.innerHTML and document.outerHTML to get the HTML then run a regexp over wat ever you get back (excluding your script of course) - in the regexp replace <script> with <notscript> and onClick with notonClick etc

That's how I'd do it
All Courses

From novice to tech pro — start learning today.