VBScript vs JScript
VBscript or JScript are default 2 scripting
engines installed by IIS. We need tell ASP file which script engine
we use. Be default, VBscript engine is used. We also may use the
following declaration statement to define which engine we plan to
use:
<%@Language="language_name%>
This declaration element must be first line
of the file(before <html> tag) can only occurred once.Any
script in a page between <%..%> will be passed to this declared
engine. Or you may use any scripting engine in page section by
using the following code:
<script language=XXXX>
....script code>
</script>
Where XXXXX is either VBScript or JScript.
You may test your IIS setting by copy/paste the
following code and save it as ASP file.
Example: display the current date (VBscript)
<html>
<head>
<title>Writing the Current date to a document with VBscript</title>
</head>
<body>
This is your first script example, Today's date is
<Script language=vbscript>
<!--
Document.Write(Date)
//-->
</script>
</body>
</html>
Example: display the current date (jscript)
Please note that jscript is case sensitive.
<html>
<head>
<title>Writing the Current date to a document with jscript</title>
</head>
<body>
This is your first script example, Today's date is
<Script language=jscript>
<!--
document.write(new Date());
//-->
</script>
</body>
|