Defines the script component's behavior.
<script language="language">
script here
</script> |
Values
- language
-
The name of the scripting language used in the script component file, such as Microsoft® Visual Basic® Scripting Edition (VBScript) or JScript.
Remarks
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. |
Example
Copy Code | |
---|---|
<?XML version="1.0"?> <component id="ScriptletFactorial"> <registration progid="Component.Factorial"/> <public> <method name="factorial"/> </public> <script language="VBScript"> <![CDATA[ Function factorial(n) If isNumeric(n) Then If n <= 1 Then factorial = 1 Else factorial = n * factorial(n-1) End If Else factorial = -2 ' Error code. End If End Function ]]> </script> </component> |