I have working in asp.net web application. Here I need to run JavaScript before page load.
I have tried:
<body oninit="funinit();" onprerender="funRender();" onload="funload();"> </body> <script type="text/javascript" language="javascript"> function funinit() { alert("funinit"); } function funload() { alert("funload"); } function funRender() { alert("funRender"); } </script>
here only funload() is working.
You can use window.onpaint for such purpose like :
<script type="text/javascript"> function preloadFunc() { alert("PreLoad"); } window.onpaint = preloadFunc(); </script>
I hope it helps you....
Just inline it?
<script type='text/javascript'> alert("funload"); </script>
Or put it in a function and call it immediately. Try to put it to the topmost of your page, however since the DOM isnt loaded yet you cant get any other elements.
What is it you want to do?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With