You are here: Reference > JavaScript > client-side > HTML DOM > properties > hidden (embed)

hidden property (embed)

Browser support:
Specifies or returns a string value that indicates whether an embed object is visible.
The embed tag is a non-standard tag in HTML but supported by all commonly used browsers.
Note that the browser support of the hidden property in JavaScript and the browser support of the HIDDEN attribute in HTML are different. While the HIDDEN attribute is supported by all commonly used browsers, the hidden property is only supported in Internet Explorer and Google Chrome. For details, see Example 2.

Syntax:

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

Possible values:

A string value in Internet Explorer and a Boolean value in Google Chrome that indicate the state of the visibility.
One of the following values:
false
The embed tag is visible.
true
The embed tag is unvisible.
Default: false.

Example HTML code 1:

This example illustrates the use of the HIDDEN attribute:
The sound file is played by a hidden embed control.
<embed src="sound.mid" autostart="true" hidden="true" />
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the hidden property:
<head>
    <script type="text/javascript">
        function ToggleHiddenState () {
            var embed = document.getElementById ("myEmbed");

            if ('hidden' in embed) {    // Google Chrome and Internet Explorer
                if (typeof (embed.hidden) === "boolean") {  // Google Chrome
                    embed.hidden = !embed.hidden;
                }
                else {  // Internet Explorer
                    embed.hidden = (embed.hidden == "true")? "false" : "true";
                }
            } else {    
                var value = embed.getAttribute ("hidden");
                embed.setAttribute ("hidden", value == "true" ? "false" : "true");
            }
        }
    </script>
</head>
<body>
    <embed id="myEmbed" type="application/x-shockwave-flash" 
        pluginspage="http://www.macromedia.com/go/getflashplayer" 
        width="300px" height="200px" src="flash.swf" hidden="true" />

    <br /><br />
    <button onclick="ToggleHiddenState ();">Change the hidden state of the embed!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content