Hi,

Suppose that I have the following JS scripts inside the <body> tag:

<script type="text/javascript"><!--
magicVar = "whatever";
// -->
</script>

<script type="text/javascript"><!--
someVar = "whatever";
// -->
</script>

Is there anyway I can change the value of magicVar in the first JS script from inside the <head> tag of the same HTML document?

In other words:
I want to have a JS script in the <head> of an HTML document that scans through all the <script> tags inside the <body> tag of the same HTML document, and if it finds a variable named "magicVar" inside any of the <body>'s <script> tags it'll change it's/their value to a new one. Can I use DOM or anything else to achieve this?

I don't want to change the value of the variable magicVar, I want to change the value that will be assigned to the variable magicVar. I know I can change it manually but this is not what I need to do.

I want to apply this to a more complicated situation.