Развернуть
onoffline Event
New for Windows Internet Explorer 8

Raised when Internet Explorer is working offline.

Syntax

Inline HTML<ELEMENT onoffline = "handler" ... > All platforms
Event propertyobject.onoffline = handlerJScript only
object.onoffline = GetRef("handler")Visual Basic Scripting Edition (VBScript) 5.0 or later only
Named script <SCRIPT FOR = object EVENT = onoffline> Internet Explorer only

Event Information

BubblesNo
CancelsNo
To invoke Set the browser to "Work Offline" on the File menu.
Default action N/A

Event Object Properties

Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query the event object for the following event properties.

Available Properties

clientX Sets or retrieves the x-coordinate of the mouse pointer's position relative to the client area of the window, excluding window decorations and scroll bars.
clientY Sets or retrieves the y-coordinate of the mouse pointer's position relative to the client area of the window, excluding window decorations and scroll bars.
offsetX Sets or retrieves the x-coordinate of the mouse pointer's position relative to the object firing the event.
offsetY Sets or retrieves the y-coordinate of the mouse pointer's position relative to the object firing the event.
screenX Sets or retrieves the x-coordinate of the mouse pointer's position relative to the user's screen.
screenY Sets or retrieves the y-coordinate of the mouse pointer's position relative to the user's screen.
srcElement Sets or retrieves the object that fired the event.
type Sets or retrieves the event name from the event object.
x Sets or retrieves the x-coordinate (in pixels) of the mouse pointer's offset from the closest relatively positioned parent element of the element that fired the event.
y Sets or retrieves the y-coordinate (in pixels) of the mouse pointer's offset from the closest relatively positioned parent element of the element that fired the event.

Remarks

If Asynchronous JavaScript and XML (AJAX) Connection Services are disabled, this event is not raised. (These services are enabled by default.)

Example

The following example sets an event handler that responds to both ononline and onoffline events using the type property of the event object.


function reportConnectionEvent(e)
{
    if (!e) e = window.event;
    
    if ('online' == e.type) {
        alert( 'The browser is ONLINE.' );
    }
    else if ('offline' == e.type) {
        alert( 'The browser is OFFLINE.' );
    }
    else {
        alert( 'Unexpected event: ' + e.type );
    }
}
window.onload = function() {
    document.body.ononline = reportConnectionEvent;
    document.body.onoffline = reportConnectionEvent;
}  

Standards Information

There is no public standard that applies to this event.

Applies To

BODY, window, HTMLBodyElement Constructor, Window Constructor

See Also

Содержимое сообществаДобавить
Page view tracker