<!DOCTYPE html>
<html>
<head>
</head>
<body>
<body>
<div id="mydiv">
<script>
var cs = document.currentScript;
function clicked(){
console.log(cs);
console.log(cs.parentNode.id);
}
</script>
</div>
<button onclick="clicked()">click</button>
</body>
</body>
</html>