Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
You are here: Reference > JavaScript > client-side > HTML DOM > properties > object (applet, object)

object property (applet, object)

Browser support:
Returns a reference to the object embedded with a object or applet element.
The type of the returned object is dependent on the embedded application.

Syntax:

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

Possible values:

Reference to the application object (Flash, Java ...).
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the object property with Macromedia Flash Player.
It clearly focuses on cross-browser support only, and it isn’t standards-compliant, but there isn't any standards-compliant cross-browser way to embed a Flash application into a document with Flash Player detection.
<head>
    <script type="text/javascript">
        function DisplaySettings () {
            var flash = document.getElementById ("flash");
            var flashObject = flash.object;
            if (flashObject) {
                var message = "";
                message += "movie: " + flashObject.movie + "\n";
                message += "bgcolor: " + flashObject.bgcolor + "\n";
                message += "quality: " + flashObject.quality;
                alert (message);
            }
            else {
                alert ("Your browser doesn't support the object property!");
            }
        }

        function ChangeBGColor () {
            var flash = document.getElementById ("flash");
            var flashObject = flash.object;
            if (flashObject) {
                flashObject.bgcolor = "#FF0000";
            }
            else {
                alert ("Your browser doesn't support the object property!");
            }
        }
    </script>
</head>
<body>
    <object id="flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="120" 
            codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0">
        <param name="movie" value="flash.swf" />
        <!-- Optional params -->
        <param name="play" value="true" />
        <param name="loop" value="true" />
        <param name="quality" value="high" />
        <!-- END Optional -->
        <embed src="flash.swf" width="300" height="120" play="true" 
            loop="true" quality="high" 
            pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" /> 
    </object>

    <br />
    <button onclick="ChangeBGColor ();">Change bgColor</button>
    <br />
    <button onclick="DisplaySettings ();">Display flash object settings</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content