Learning ASP Series -- Getting Your Hands Dirty With VBScript

Mar 27
22:00

2002

Amrit Hallan

Amrit Hallan

  • Share this article on Facebook
  • Share this article on Twitter
  • Share this article on Linkedin

I know some people don't like VBScript for ... but it's very easy to get familiar with, andonce you know how to create your ASP pages in ... you canmove on to any ...

mediaimage

I know some people don't like VBScript for being
Microsoft-Centric,Learning ASP Series -- Getting Your Hands Dirty With VBScript Articles but it's very easy to get familiar with, and
once you know how to create your ASP pages in VBScript, you can
move on to any programming language of your choice.

First thing first: HTML tags and ASP scripts don't socialize
well, and although it is not a politically correct agenda, you
have to segregate them. Whenever you are writing the VBScript
code for ASP, enclose the code within <% %>.

So if you want to initialize a VBScript variable, do it like
this:

<%
Dim name
name = "Tutan Khamen"
%>

For instance, if you want to use the variable "name" in your HTML
(ASP, actually) page, all you have to do is:

<%@Language=VBScript%>
<% Option Explicit %>


Testing a VBSCript< itle><br></head><br><body><br><%<br>Dim name<br>name = "Tutan Khamen"<br>%><%=name%>! An ancient Egyptian mummy!</p><br><br></body><br></html><br><br>Another example:<br><br><%@Language=VBScript%><br><% Option Explicit %><br><html><br><head><br><title>Testing a VBSCript< itle><br></head><br><body><br><%<br>Dim number1, number2<br>number1 = 33<br>number2 = 44<br>%>The product of <%=number1%> and <%=number2%> is <%=number1 *<br>number2%></p><br><br></body><br></html><br><br>So now its amply clear that whenever you want to insert Server<br>Side code, or a part of it, you enclose it within <% %>.<br><br>You can try making short programs and test run the page.

Article "tagged" as:

Categories: