Windows Script Components  

<script> Element

Defines the script component's behavior.

<script language="language">
   script here


The name of the scripting language used in the script component file, such as Microsoft® Visual Basic® Scripting Edition (VBScript) or JScript.


If XML validation is not enabled, the XML parser ignores all lines inside the <script> element. However, if XML validation is enabled by including the <?XML ?> declaration at the top of the script component file, the XML parser can misinterpret greater than (<), less than (>), and other symbols used in script as XML delimiters.

If you are creating a file that conforms closely to XML syntax, you must make sure that characters in your script element are not treated as XML reserved characters. To do so, enclose the actual script in a <![CDATA[ ... ]]> section. For details about XML validation, see Script Component Files and XML Conformance.

Note   Do not include a CDATA section unless you also include the <?XML ?> declaration.


<?XML version="1.0"?>
<component id="ScriptletFactorial">
<registration progid="Component.Factorial"/>
   <method name="factorial"/>

<script language="VBScript">
Function factorial(n)
   If isNumeric(n) Then
      If n <= 1 Then
         factorial = 1
         factorial = n * factorial(n-1)
      End If
      factorial = -2   ' Error code.
   End If
End Function

See Also

Script Component File Contents