最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

onerror Event

Internet Development Index

Fires when an error occurs during object loading.

Syntax

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

Event Information

BubblesNo
CancelsYes
To invoke Cause one of the following errors to occur:
  • Run-time script error, such as an invalid object reference or security violation.
  • Error while downloading an object, such as an image.
Default action Displays the browser error message when a problem occurs and executes any error handling routine associated with the event.

Event Object Properties

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

Available Properties

altKey Sets or retrieves a value that indicates the state of the ALT key.
altLeft Sets or retrieves a value that indicates the state of the left ALT key.
ctrlLeft Sets or retrieves the state of the left CTRL key.
returnValue Sets or retrieves the return value from the event.
shiftLeft Retrieves the state of the left SHIFT key.
srcElement Sets or retrieves the object that fired the event.
type Sets or retrieves the event name from the event object.

Remarks

To suppress the default Microsoft® Internet Explorer error message for the window event, set the returnValue property of the event object to true or simply return true in Microsoft JScript®.

The onerror event fires for run-time errors, but not for compilation errors. In addition, error dialog boxes raised by script debuggers are not suppressed by returning true. To turn off script debuggers, disable script debugging in Internet Explorer by choosing Internet Options from the Tools menu. Click the Advanced tab and select the appropriate check box(es).

Examples

The following examples use the onerror event to handle run-time script errors and object load errors.

This example specifies an invalid script entry. The script in the text field is evaluated when the Throw Error button is clicked. The onerror event fires because the script is invalid. The error results are inserted at the bottom of the sample page instead of in a dialog box.

<SCRIPT>
window.onerror=fnErrorTrap;
function fnErrorTrap(sMsg,sUrl,sLine){
oErrorLog.innerHTML="<b>An error was thrown and caught.</b><p>";
oErrorLog.innerHTML+="Error: " + sMsg + "<br>";
oErrorLog.innerHTML+="Line: " + sLine + "<br>";
oErrorLog.innerHTML+="URL: " + sUrl + "<br>";
return false;
}
function fnThrow(){
eval(oErrorCode.value);
}
</SCRIPT>
<INPUT TYPE="text" ID=oErrorCode VALUE="someObject.someProperty=true;">
<INPUT TYPE="button" VALUE="Throw Error" onclick="fnThrow()">
<P>
<DIV ID="oErrorLog">
</DIV>
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

This example shows how to set the handler for the onerror event in script before an image source is specified. When the invalid source is set on the img element, the event fires.

<SCRIPT>
var sImg='<IMG STYLE="display: none;" ID=oStub ALT="Default Text">';
function fnLoadFirst(){
oContainer.innerHTML=sImg;
oStub.onerror=fnLoadFail1;
oStub.src="";
oStub.style.display="block";
}
function fnLoadFail1(){
oStub.alt="Image failed to load.";
return true;
}
</SCRIPT>
<INPUT TYPE=button VALUE="Load First Image" onclick="fnLoadFirst()">
<DIV ID=oContainer></DIV>
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

There is no public standard that applies to this event.

Applies To

IMG, OBJECT, STYLE, window

See Also

onerrorupdate
揭阳市| 扎兰屯市| 柏乡县| 衡阳市| 兖州市| 通化市| 汉沽区| 渝北区| 全椒县| 南昌县| 左权县| 玉龙| 江阴市| 庆云县| 彭阳县| 木兰县| 文山县| 阿巴嘎旗| 昭苏县| 上犹县| 麻阳| 扎赉特旗| 藁城市| 巨鹿县| 平安县| 普宁市| 巴楚县| 康保县| 山东省| 姚安县| 荔浦县| 尖扎县| 兰溪市| 巴中市| 万安县| 游戏| 雷山县| 满洲里市| 琼中| 滦平县| 永福县|