Search DaTutorials:  
HOME
DHTML Reference
Introduction
Reference

SRC Attribute | src Property


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

Syntax

HTML<ELEMENT SRC = sURL... >
Scriptingobject.src [ = sURL ]

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 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="http://www.microsoft.com/";
  alert (document.all.iframe1.src);
}

Standards Information

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

Applies To

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

     Loans | Free Ringtones | Gas Suppliers | Mobile Phones | Mortgages
Home     Link To Us     Ad With Us     Contact Us     Tell A Friend     Affiliates     Blog     MsOfficeHelp