Using HTML DOM to change contents of Script Tag

When we use html dom,we normally run code such as :

document.getElementById('id').innerHTML = 'new text'
to change the contents of a tag such as <div>

However I tried this with the <script> tag and it doesn’t seem to be working. What should I try?

document.getElementsByTagName('script')[0].innerHTML = "document.write('ok')"

8 thoughts on “Using HTML DOM to change contents of Script Tag”

  1. 441681 881081Properly, that is great, however consider further options weve got here? Could you mind submitting an additional article relating to them also? Several thanks! 271656

  2. 840785 829264Ill appropriate away grasp your rss feed as I cant in locating your e-mail subscription hyperlink or e-newsletter service. Do youve any? Please let me realize so that I might subscribe. Thanks. 610243