In ASP, VBScript is the default language. VBScript is similar to Javascript,
a client side programming language used to add functionality through the <script> tag.
VBScript in Server side Scripting
VBScript used to program ASP converts it to server side scripting.
Any given web page could be created from a combination of server side and client side scripting.
The confusing part is this: You must use these client side scripting
languages (Javascript, VBScript, etc) to program in ASP!
Server Side ASP Code using VBScript:
<html>
<body>
<%
Dim myString
myString = Date()
Response.Write("The date is: " & myString)
%>
</body>
</html>
O/P:
The date is: 10/26/2006
Note:
If you know VBScript or Visual Basic programming then you know Dim as Dimension,
which is used to give "dimension" to variables. It is a good programming practice
to "dimension" all your variables before you use them, as we did with
myString in the above example.
VBScript and JavaScript in client side Scripting
Now that we have our ASP Code working, say that we wanted to use our ASP code along
with some client side Javascript code. We are just going to use the
Javascript write function and have our ASP Code fill in the Date.
All the Javascript client code is in the default color, but ASP Server Side Code is in Red.
<script>
document.write("The date is:<%
Dim myString
myString = Date()
Response.Write(myString)
%>")
</script>
O/P:
The date is: 10/26/2006
Programming ASP with VBScript
You should be able to follow along with our ASP tutorial with little or
no VBScript knowledge, but just in case you want to know more or find some of
the VBScript syntax or code confusing then you can check out our VBScript Tutorial
Programming ASP in Javascript
VBScript is the default scripting language that ASP is coded in,
so if you want to specify a different scripting language you have to
state which scripting language you will be using at the very beginning of your code.
Below is the line of code that must be your first line of ASP code or else your page will
break and you'll get a boring error message
ASP Code:
<%@ Language="javascript"
'The rest of your ASP Code....%>
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.