IHTMLScriptElement3::src Property

Retrieves the URL to an external file that contains the source code or data.


HRESULT IHTMLScriptElement3::get_src(BSTR *p);
HRESULT IHTMLScriptElement3::put_src(BSTR v);


  • p
    Pointer to a variable of type BSTR that receives the URL of the source code or data.
  • v
    BSTR that specifies the URL of the source code or data.

Return Value

Returns S_OK if successful, or an error value otherwise.


A script element can use the SRC attribute to refer to code stored in an external script library. If a script element refers to an external library and also contains code local to the block defined by the element, the code in the external library is executed before the local code.

In Microsoft Internet Explorer 5 and later , the SRC attribute of the script element can refer to an XML data set if the LANGUAGE attribute is set to XML.

The SRC attribute was first available in Internet Explorer 3.022. The src property is exposed through the object model as of Internet Explorer 4.0.