www.fgks.org   »   [go: up one dir, main page]

SRC Attribute | src Property

Sets or retrieves a URL to be loaded by the object.

Syntax

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

Possible Values

sURLString that specifies or receives the URL.

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

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.

Examples

This example uses the src property to change the image's SRC attribute.

<body  >
... 
	<img id="oImage" src="cone.jpeg">

</body>
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

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 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

APPLET, EMBED, FRAME, IFRAME, IMG, INPUT type=image, XML


MSDN Library
Web Development
HTML and CSS
HTML and DHTML Reference
Properties
src (APPLET, EMBED, FRAME, ...)