Javascript DOM onpageshow Event via HTML Tag onpageshow attribute

Introduction

This example demonstrates how to assign an "onpageshow" event to a body element.

View in separate window

<!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>



PreviousNext

Related