Say I have a piece of html with inline javascript like this:

```
<div id="myDiv">
</div>

<script type="text/javascript">
    var myElement = document.getElementById("myDiv");
    if(!myElement)
        throw "Invalid";
<script>

<div /> ...and so on

```

So I have a script tag surrounded by div tags and the script operates on a div declared before it.

Is this a browser safe/HTML standard way of doing things?