當網頁瀏覽器開始離線工作時,onoffline 屬性就會觸發。您可以嘗試執行以下程式碼來實作onoffline 屬性 -
<!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>
以上是當瀏覽器開始離線工作時,在HTML中執行腳本?的詳細內容。更多資訊請關注PHP中文網其他相關文章!