Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Embed src property

Embed src property

Embed Object Reference Embed object

Example

Return the URL of the embedded file:

var x = document.getElementById("myEmbed").src;

x

The output is:

http://www.w3cschool.cc/jsref/helloworld.swf

Try it »


Definition and Usage

The src property is used to set or return the value of the src attribute of the embed element.

The src property describes the external address (URL) of the embedded file.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the src property.


Syntax

Return the src attribute:

embedObject

.src

Set the src attribute:

embedObject

.src=

URL

Attribute values

Value Description
URL Describes the external address (URL) of the embedded file
 可能值:     
  • Absolute URL - an address pointing to another site (e.g. src="http://www.example.com/hello.swf")
  • Relative URL - an address pointing within the site (e.g. src="hello.swf")
  • |

    Technical Details

    Return Value: String, representing the URL of the embedded file, returning the actual URL including the protocol part ( http://)

    Related pages

    HTML Reference Manual: HTML src property


    Embed Object Reference Embed object