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

Skip Navigation Links
  

Internet Explorer Developer Center

Click to Rate and Give Feedback
Properties
 src Property
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
Tags What's this?: Add a tag
Community Content
 
Add Community Content
How to preview a local image before uploading it, IE6; what about IE7?      IE7 and local image preview before upload   |   Edit   |  

<script>

ie4up=true;
function Picture3Image()
{ if(document.all.item("TFileID3") !=null){
if (ie4up){document.all.item("Picture3").src= document.all.item("TFileID3").value; }
else {document.getElementById("Picture3").src= document.getElementById("TFileID3").value;
}
}else{alert("wwwwwww");}
}

</script>

<input size="37" style=" WIDTH: 360px" id="TFileID3" name="TFileID3" type="file" >
&nbsp; </nobr> <img id="Picture3" src="Images/trans.gif" border="0" width="70px" height="91px">

Tags What's this?: Add a tag
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG