IHTMLScriptElement

IHTMLScriptElement


This interface specifies a script for the page that will be interpreted by a script engine.

Code within the SCRIPT block that is not contained within a function is executed immediately as the page is loaded. To keep scripts from being displayed on down-level browsers, the SCRIPT block should be nested within a comment block.

This element is a block element.

IHTMLScriptElement Methods
put_src   get_src   put_htmlFor  
get_htmlFor   put_event   get_event  
put_text   get_text   put_defer  
get_defer   get_readyState   put_onerror  
get_onerror   put_type   get_type  

IHTMLScriptElement::put_src

HRESULT put_src(
    BSTR v 
);

Specifies an external file that contains the source code.

v
String specifying the URL of the external file.

A script can contain an external reference as well as code within the block. The code specified by src precedes the code contained within the document.

See also get_src

IHTMLScriptElement::get_src

HRESULT get_src(
    BSTR *p 
);

Retrieves an external file that contains the source code.

p
Address of a variable that receives the URL of the external file.

A script can contain an external reference as well as code within the block. The code specified by src --> precedes the code contained within the document.

See also put_src

IHTMLScriptElement::put_htmlFor

HRESULT put_htmlFor(
    BSTR v 
);

Sets which element is being bound to the event script. This htmlFor property corresponds to the HTML FOR= attribute.

For more information on inline script, see Attaching an Event Handler in the Event Model documantation.

v
String specifying the element name.

See also get_htmlFor

IHTMLScriptElement::get_htmlFor

HRESULT get_htmlFor(
    BSTR *p 
);

Retrieves which element is being bound to the event script. This htmlFor property corresponds to the HTML FOR= attribute.

For more information on inline script, see Attaching an Event Handler in the Event Model documantation.

p
Address of a variable that receives the element name.

See also put_htmlFor

IHTMLScriptElement::put_event

HRESULT put_event(
    BSTR v 
);

Sets the event for which the script is being written.

v
String specifying the event.

See also get_event

IHTMLScriptElement::get_event

HRESULT get_event(
    BSTR *p 
);

Retrieves the event for which the script is being written.

p
Address of a variable that receives the event.

See also put_event

IHTMLScriptElement::put_text

HRESULT put_text(
    BSTR v 
);

Retrieves the text contained within the SCRIPT element.

v
String specifying the text.

See also get_text

IHTMLScriptElement::get_text

HRESULT get_text(
    BSTR *p 
);

Retrieves the text contained within the SCRIPT element.

p
Address of a variable that receives the text.

See also put_text

IHTMLScriptElement::put_defer

HRESULT put_defer( 
    VARIANT_BOOL v 
);

Sets the Boolean value indicating whether this script's execution is deferred until the document completes loading.

v
Boolean value specifying whether the script's execution is deferred until after the document has completed loading. If TRUE, the script execution is deferred; otherwise, the script will execute.

See also get_defer

IHTMLScriptElement::get_defer

HRESULT get_defer(
    VARIANT_BOOL *p 
);

Retrieves the Boolean value indicating whether this script's execution is deferred until the document completes loading.

p
Address of a variable that receives TRUE if the script execution is deferred, or FALSE if not.

See also put_defer

IHTMLScriptElement::get_readyState

HRESULT get_readyState(
    BSTR *p 
);

Retrieves the current state of an object being downloaded.

p
Address of a variable that receives the state. Can be one of these values:
complete The object is completely loaded.
interactive The object can be interacted with even though it is not fully loaded.
loading The object is currently being loaded.
unitialized The object is not created. Usually when the object is being downloaded.

Each object can independently determine which of the states it exposes.

IHTMLScriptElement::put_onerror

HRESULT put_onerror(
    VARIANT v 
);

Sets the inline script associated with the onerror event on the script element.

For more information on inline script, see Attaching an Event Handler in the Event Model documentation.

v
VARIANT structure that contains the onerror script to be set.

See also get_onerror

IHTMLScriptElement::get_onerror

HRESULT get_onerror(
    VARIANT *p 
);

Retrieves the inline script associated with the onerror event on the script element.

For more information on inline script, see Attaching an Event Handler in the Event Model documentation.

p
Address of a VARIANT structure that contains the onerror script.

See also put_onerror

IHTMLScriptElement::put_type

HRESULT put_type(
    BSTR v 
);

Indicates the type script of the scripting language as a string for the IHTMLScriptElement object. The contents of this script is read only, and can be modified only at design time.

v
String value specifying the script type.

See also get_type

IHTMLScriptElement::get_type

HRESULT get_type(
    BSTR *p 
);

Retrieves the string that represents the language that the current script was written in. The default language is JScript.

p
Address of a string that receives the language type. The possible scripting languages include the following:
JScript Specifies that the script is written in JScript.
Jscript Specifies the language as JScript.
vbs Specifies the language as VBScript.
vbscript Specifies that the script is written in VBScript.

This is an HTML 4.0 attribute and is equivalent to the language property.

See also put_type

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.