Javascript DOM ononline Event via HTML Tag ononline attribute

Introduction

Open the File menu and click on "Work Offline" to toggle between working online and offline.

The ononline and onoffline events are supported in Firefox.

View in separate window

<!DOCTYPE html>
<html>
<body ononline="onFunction()" onoffline="offFunction()">
<p id="demo"></p>
<script>
function onFunction() {/*from   w  w  w  . j  av a2s. c o m*/
  document.getElementById("demo").innerHTML =  "Your browser is working online.";
}

function offFunction() {
  document.getElementById("demo").innerHTML = "Your browser is working offline.";
}
</script>

</body>
</html>
Bubbles: No
Cancelable: No
Event type: Event
Supported HTML tags: <body>
DOM Version: Level 3 Events



PreviousNext

Related