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

data property (object)

Browser support:
Sets or retrieves the location of the data for an object.

Syntax:

object.data;
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: data

Possible values:

String that sets or retrieves the URL of the data file.
The URL can be an absolute or relative path as well. If a relative path is used and the codeBase property of the object is specified, then the relative path is relative to the value of this property, else the relative path is relative to the base URL.
The base URL is the location of the current document, but it can be overridden by the base tag.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the data attribute with Macromedia Flash Player.
The codeBase attribute of the object tag is missing from this example. You can check the version of the user's Flash player with this attribute in Internet Explorer, and if it does not exist or its version is lower than required, the browser pops up an installation dialog. Unfortunately the use of the codeBase attribute causes problems in Firefox. See the codeBase attribute for details.
<object data="flash.swf" type="application/x-shockwave-flash" width="300px" height="200px"
        archive="http://archive.somePlace.com/swflash.cab#version=3,0,11,0">
        <!-- If flash player is not installed, pluginurl helps the user to download it in Firefox -->
    <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />
    
    <param name="movie" value="flash.swf" />  
    <param name="bgcolor" value="#FFFFE0" />  
    <param name="quality" value="high" />
</object>
Did you find this example helpful? yes no

Example HTML code 2:

This example has similar functionality to the previous one, but it creates the Macromedia Flash Movie dynamically. The usage of the data property see the flash.js file.
Code
flash.js
<head>
    <script type="text/javascript" src="flash.js"></script>
    <script type="text/javascript">
        function CreateFlash () {
            var flashContainer = document.getElementById ("flashContainer");
            var flash = new Flash ();
            flash.Init (flashContainer, "flash.swf", 300, 200);
            flash.SetParam ('bgcolor', '#000000');
            flash.SetParam ('quality', 'high');
            flash.Create ();
        }
    </script>
</head>
<body onload="CreateFlash ()">
    <div id="flashContainer"></div>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content