เมื่อเว็บเบราว์เซอร์เริ่มทำงานออนไลน์ ออนไลน์ ทริกเกอร์แอตทริบิวต์ คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้งาน online แอตทริบิวต์ −
ตัวอย่าง
<!DOCTYPE html>
<html>
<body ononline = "onlineFunc()" onoffline = "offlineFunc()">
<script>
function onlineFunc() {
alert ("Working online!");
}
function offlineFunc() {
alert ("Workinf offline!");
}
</script>
<p>Got o the web browser menu bar and click the File menu. Select
"Work Offline" and toggle between online and offline.</p>
</body>
</html>