spacer
Web Development Tutorials ASP Tutorials
 Developer Newsletter

Tutorials
AJAX
ASP
CGI & Perl
CSS
Flash
HTML
Illustrator
Java
JavaScript
Linux
MySQL
PHP
Photoshop
Python
Wireless
XML
Miscellaneous


Scripts Directory
AJAX Scripts
ASP Scripts
ASP.NET Scripts
CGI & Perl Scripts
Flash Scripts
Java Scripts
JavaScript Scripts
PHP Scripts
Python Scripts
Remotely Hosted Scripts
Tools & Utilities Scripts
XML Scripts

Web Hosting Directory
ASP.NET
Budget
Dedicated Servers
Ecommerce
Linux
Resellers
Shared
Small Business
Windows

Developer Manuals
Learn HTML
Learn PHP
Learn CSS
Learn AJAX
Learn JavaScript
Learn Pear
Free White Papers

Developer Resources
Developer Tools
Developer Content
Survey Software
Dedicated Servers




Getting Your Hands Dirty With VBScript

By Amrit Hallan
2004-06-09


Getting Your Hands Dirty With VBScript

I know some people don't like VBScript for being Microsoft-Centric, 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 %>
<html>
<head>
<title>Testing a VBSCript</title>
</head> <body> <% Dim name name = "Tutan Khamen"
%>

<p><%=name%>! An ancient Egyptian mummy!</p>

</body>
</html>

Another example:

<%@Language=VBScript%>
<% Option Explicit %>
<html>
<head>
<title>Testing a VBSCript</title>
</head>
<body>
<%
Dim number1, number2
number1 = 33
number2 = 44
%>

<p>The product of <%=number1%> and <%=number2%> is <%=number1 * number2%></p>

</body>
</html>

So now its amply clear that whenever you want to insert Server Side code, or a part of it, you enclose it within <% %>.

You can try making short programs and test run the page.

Tutorial Pages:
» Getting Your Hands Dirty With VBScript


 | Bookmark Print |   Write For Us
Related Tutorials:
» Decision Making and Looping
» Arrays in ASP
» Emailing Form Data with ASP
» Sending HTML Email with ASP
» Dumping Form Information Onto a Web Page
» Installing Personal Web Server



About the NetVisits, Inc Network | Write For Us | Advertise
Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy.
Visit other NetVisits, Inc. sites: