dsaba Posted August 25, 2007 Share Posted August 25, 2007 Many ajax and javascript functions change the innerHTML of elements in the source, writing and rewriting things in the source You can run any javascript function or action you want that would change the source, but when you view it, it will always show the original source before a JS function changed it Is there a way to view the changed source after each time a JS functoin changes it?? for example: <span id="whatever">This is the original source code</span> then you may run this piece of JS: whatever.innerHTML= 'Changed source code!'; but when you right click and press 'view source" you will always get this: <span id="whatever">This is the original source code</span> I want to get the changed source code, maybe its possible to write the changed source code to another file, or use some kind of HTTP prog to read the changes on an html page??? Any help appreciated thanks Quote Link to comment Share on other sites More sharing options...
dsaba Posted August 26, 2007 Author Share Posted August 26, 2007 I found this to work: <html> <head> <script type="text/javascript"> //document.open('text/plain').write(document.documentElement.outerHTML); function change_span() { whatever.innerHTML= 'The changed source code!'; } function get_source() { window.open().document.open('text/plain').write(document.documentElement.outerHTML); } </script> </head> <body> <span id="whatever">Original Source!</span> <script> change_span(); get_source(); </script> </body> </html> but is there a better way to do this and if possible can I write it to a .txt file??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.