Body unload outside of body tag

hankknight
hankknight used Ask the Experts™
on
How can I move this:

<body onunload="unloadAction()">

To here?

<script type="text/javascript">
</script>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
<body>
My web page
<script>
  document.body.onunload=function () {alert("hi")}
</script>
</body>

or

<body>

<script>  
  function unloadaction(){
    alert('hi')
  }

  document.body.onunload=function (){unloadaction()}
</script>  

My web page

</body>

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial