The most robust way to achieve this is:
<script>
(function(script){
//do whatever you want with script here...
})(document.currentScript);
</script>
It is more robust than other solutions because you may also use it after the document has loaded. Also it does not require the definition of a variable (if you have several script tags this might be an issue since you cannot reuse the same variable name). With JQuery:
<script>
(function(script){
$(document).ready(function(){
// do whatever you want after the DOM as loaded here...
});
})(document.currentScript);
</script>