SRC Attribute | src Property
SRC Attribute | src Property

Retrieves the URL to an external file that contains the source code or data.

Syntax

HTML<ELEMENT SRC = sURL... >
Scripting[ sURL = ] object.src

Possible Values

sURLString that specifies or receives the URL of the source code or data.

The property is read/write. The property has no default value.

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are not supported in IE8 mode. For more information, see About Dynamic Properties.

Remarks

A script element can use the SRC attribute to refer to code stored in an external script library. If a script element refers to an external library and also contains code local to the block defined by the element, the code in the external library is executed before the local code.

 New for Windows Internet Explorer 8 Internet Explorer 8 or later. In IE8 mode, the value of the SRC attribute depends on the context of the reference to the attribute. When read as a Document Object Model (DOM) attribute, SRC returns an absolute URL. The value specified by the page author is returned when SRC is read as a content attribute, when the page is displayed in an earlier document compatibility mode, or when the page is viewed with an earlier version of the browser. For more information, see Attribute Differences in Internet Explorer 8.

In Microsoft Internet Explorer 5 and later, the SRC attribute of the script element can refer to an XML data set if the LANGUAGE attribute is set to XML.

The SRC attribute was first available in Internet Explorer 3.022. The src property is exposed through the object model as of Internet Explorer 4.0.

Standards Information

This property is defined in HTML 4.0 World Wide Web link and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 World Wide Web link.

Applies To

SCRIPT, HTMLScriptElement Constructor
Community Content

Cross-domain XML scripts are inaccessible.
Added by:yecril

The resulting script object does not have the XMLDocument property.

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View