This example demonstrates how to assign an "onpageshow" event to a body element.
<!DOCTYPE html> <html> <body onpageshow="myFunction()"> <h1 id="demo"></h1> <script> function myFunction() {//from w ww . j a v a 2 s.com document.getElementById("demo").innerHTML = "Welcome To My Homepage!"; } </script> </body> </html>
Bubbles: | No |
---|---|
Cancelable: | No |
Event type: | PageTransitionEvent |
Supported HTML tags: | <body> |