Sets or retrieves a URL to be loaded by the object.
dhtml语法
HTML | <ELEMENT SRC
= sURL... >
|
---|
Scripting | object.src [ = sURL ] |
---|
DHTML可能的值
sURL | String 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 onmousedown="oImage.src='sphere.jpg'"
onmouseup="oImage.src='cone.jpg'">
:
<IMG ID=oImage SRC="cone.jpeg">
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="/hbcms/php/r.php?url=http%3A%2F%2Fwww.microsoft.com/";
alert (document.all.iframe1.src);
}
是否符合公共标准
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