Sets or retrieves a URL to be loaded by the object.
Syntax
| HTML | <ELEMENT SRC
= sURL... >
|
|---|
| Scripting | [ sURL = ] object.src |
|---|
Possible Values
| sURL | String that
specifies or receives the URL. |
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
Internet Explorer 8 or later. In IE8 mode, the value of the SRC attribute of the frame and iframe elements 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.
Example
This example uses the src
property to change the src
attribute of an iframe.
function changeFrame(){
alert (document.all.iframe1.src);
document.all.iframe1.src="http://www.microsoft.com/";
alert (document.all.iframe1.src);
}
Standards Information
This property is defined in
HTML 4.0
and
is defined in
World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1
.
Applies To