You are here: Reference > JavaScript > client-side > HTML DOM > properties > altHtml (applet, object)

altHtml property (applet, object)

Browser support:
Sets or retrieves the HTML content that is executed if the object or applet element fails to load.
A value for the altHtml property can be specified in an event handler for the onerror event. For a cross-browser solution, write the HTML content in the object and applet elements. It has the same effect. See the examples for details.


You can find the related objects in the Supported by objects section below.
This property is write-only.

Possible values:

String that sets or retrieves the alternate HTML code.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the altHTML property. The alternate HTML content is visible if Java is not installed.
    <script type="text/javascript">
        function AppletError (applet) {
            applet.altHtml = "<b>The Java Applet cannot be started!</b>";
    <applet code="HelloWorld.class" codebase="/external/examples/common/java/"
            onerror="AppletError (this);" style="width:200px; height:50px;">
Did you find this example helpful? yes no

Example HTML code 2:

A cross-browser solution for the previous example:
    <applet code="HelloWorld.class" codebase="/external/examples/common/java/" style="width:200px; height:50px;">
        <b>The Java Applet cannot be started!</b>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content