I need to write a script that will use document.write to produce some output, but I need to know what element it is contained, example:
<p>
paragraph 1
<script src="test.js" type="text/javascript"></script>
</p>
I need to get a reference to the p tag…
thanks!
At the time the script is run, the document is only partially loaded. So your script element would be the last node in the document: