當網頁瀏覽器開始在線上工作時,ononline 屬性就會觸發。您可以嘗試執行以下程式碼來實作ononline 屬性 -
<!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中文網其他相關文章!