where to place browser event (resize/scroll) detection call
- by karl
I'm trying to alert a message when the browser is resized or scrolled. I'm detecting the 2 events in the body
<body onResize="doDisp();" onScroll="doDisp();" >
where doDisp is this inside the <script> tag
<script type="text/javascript">
function doDisp(){
alert("browser changing state");
}
</script>
but isn't it bad practice to have javascript in the body tag? Is there a cross-browser way to keep all the javascript inside the <script> tags?