web design tips
 

web design tipsVBScript: Javascript Made Easy.

VBScript is a web language for inserting into HTML documents. It's a lot like Java, but is easier to write thanks to its Visual Basic-like code.

Is It Really Easier?

Well, it's largely a matter of personal preference, and what you're used to. If you're an experienced programmer, you'll probably think that VBScript is a joke, and prefer Javascript. If you're not, though, VBScript's English-like code can make things clearer and quicker when you're writing scripts. For example, compare this code for an if/then/else condition.

Javascript:

if (a == 1) {
alert("a");
} else if (b == 1) {
alert("b");
} else {
alert("z");
}

VBScript:

if a=1 then
msgbox "a"
elseif b=1 then
msgbox "b"
else
msgbox "c"
end if

See
what I mean? This is a pretty representative sample of the differences (a 'for' block would provide a more extreme example). To put it simply, Javascript looks 'code-like', with all kinds of brackets and semicolons all over the place - and it's all-too-easy to forget one. VBScript, on the other hand, is designed to be more human, and closer to natural language. While its approach is less flexible for complicated operations, it's much quicker for simpler ones.

Useful VBScript Functions.

Here are a few of the functions VBScript has that you'll be wishing you could use in Javascript.

DateDiff. Works out the difference between two dates - this is a nightmare in most programming languages.

FormatCurrency. Takes a number and formats it as whatever currency you want.

InStr. Looks for some text in a string, and stops when it finds it. Useful for including text up to a special 'stop' phrase.

Split. Divides some text up into an array depending on where a certain character is (similar to PHP's explode command, and just as useful).

Replace. Lets you look through some text and replace every instance of a certain character or phrase.

Apart from this, VBScript offers quite a few of Javascript's functions. Even though that's useful, it can sometimes make you feel like you're just writing Javascript in an odd way - the same way that doing anything complex with desktop Visual Basic gradually seems to turn into writing a kind of C with a slightly different layout. If you keep things simple, though, VBScript is good at what it does.

So What's the Catch?

Well, the catch is a big one. Pages written using VBScript won't work in any web browser other than Internet Explorer - it's Microsoft's own language, and no-one else supports it. For better or for worst, the web has long since standardised on Javascript. This unfortunate fact means that, for use on the web, you're pretty much stuck with Javascript, unless you want to alienate many of your visitors, or your scripting isn't essential for your site to work. This is the number one reason why you hardly ever see any VBScript anywhere on the web.

If you're writing web pages to go on a corporate intranet or some other environment where you have control over how users access the site, however, VBScript can make your life considerably easier. You might also consider using it if you've written Javascript that works in every browser except Internet Explorer, as just using VBScript for one or two things can save you playing around with lengthy workarounds.

An Alternative Way of Doing Things.

If Javascript intimidates you and you'd really like to use VBScript, but you want your site to work on as many web browsers as possible, there is a solution! VBScript and Javascript that there are converters freely available to translate between them - a good one is at http://slingfive.com/pages/code/scriptConverter/, but there are plenty more. You can simply write your scripts in VBScript and then run them through the translator to turn them into cross-browser Javascript, without having to write a word of Javascript!

Even better, once you've got the two versions of the script side by side, you can compare them, and start to learn how things are done in Javascript. Before long, you'll be writing it with no trouble.

Which Database is Right for You

The Many Flavours of HTML

Taking Your Website Mobile

Photoshop a Graphic Designers Dream

Picking a Colour Scheme

 

Web Design
5 Simple Steps to Accepting Payments.
5 Ways to Avoid the 1998 Look.
6 Reasons Why You Need a Website.
7 Ways to Make Your Web Forms Better.
A Question of Scroll Bars.
Ads Under the Radar: Linking to Affiliates.
AJAX: Should You Believe the Hype?
All About Design: Principles and Elements.
An Introduction to Paint Shop Pro.
An Issue of Width: the Resolution Problem.
Avoiding the Nuts and Bolts: Content Management Software.
Beware the Stock Photographer: Picking Your Pictures.
Building a Budget Website.
Building Online Communities.
Clean Page Structure: Headings and Lists.
ColdFusion: Quicker Scripting, at a Price.
Column Designs with CSS.
Content is King.
CSS and the End of Tables.
Cut to the Chase: How to Make Your Website Load Faster.
Designing for Sales.
Designing for Search Engines.
Dreamweaver: The Professional Touch.
Encryption and Security with SSL.
Finding a Good HTML Editor.
Focus on the User: Task-Oriented Websites.
Fonts are More Important Than You Think.
Free Graphics Alternatives.
FrontPage: Easy Pages.
Hints All the Way.
Hiring Professionals: 5 Things to Look For.
How Databases Work.
How the Web Works.
How to Get Your Website Talked About on Blogs.
How to Install and Configure a Forum.
How to Make Visitors Add You to Their Favorites.
How to Run Ads Without Driving Visitors Crazy.
How to Set Up Your Hosting in 5 Minutes Flat.
IIS and ASP: Microsoft's Server.
Image Formats: GIF, JPEG, PNG and More.
It's a World Wide Web: Going International.
JSP: Java on Your Server.
LAMP: The Most Popular Server System Ever.
Making Friends and Influencing People: the Importance of Links.
Making Searches Simple.
Offering Free Downloads on Your Website.
Opening a Web Shop with E-Commerce Software.
tag - they have one extra tag before it. This is the doctype, and it must be present right at the top of your document for it to be valid HTML. There are only really
Perl: Cryptic Power.
Photoshop: a Graphic Designer's Dream.
Picking a Colour Scheme.
Printing and Sending: the Two Things Users Want to Do.
Putting Multimedia to Good Use.
Python and Ruby: the Newer Alternatives.
Registering a Domain Name.
Registering Your Users by Stealth.
RSS: Really Simple Syndication.
Setting Up a Mailing List.
Setting up a Test Server on Your Own Computer.
Some Places to Go For More Information.
Taking HTML Further. HTML might seem like a simple language for web documents, and to an extent, it is - that's what it was intended to be. If you know what
Taking HTML Further with Javascript. Once you've built your HTML pages, you might need them to do something a little more interactive on the client-side (that
Taking Your Website Mobile.
Text Ads: Unobtrusive Advertising.
The 5 Principles of Effective Navigation.
The Art of the Logo.
The Basics of Web Forms.
The Basics of Web Servers.
The Case Against Flash.
The Confusing World of Web Hosting: Making Your Decision.
The Evils of PDFs.
The Importance of Validation.
The Many Flavours of HTML.
The Smaller, the Better: Avoiding Graphical Overload.
The Top 10 Biggest Web Design Mistakes.
The Web Designer's Toolbox.
The Web is Not Paper.
There's More than One Web Browser.
Time for User Testing.
Titles and Headlines: It's Not a Newspaper.
Tracking Your Visitors.
Understanding Web Jargon.
Uploading Your Website with FTP.
Using Flash Sensibly.
Using Quizzes and Games to Get Traffic.
VBScript: Javascript Made Easy.
Websites and Weblogs: What's the Difference?
What Do You Want Your Website to Do?
What You See Isn't Always What You Get.
Which Database is Right for You?
Why Doing It Yourself is Best.
Why Java Will Drive Your Visitors Away.
Why Word is Bad for the Web.
Why You Should Put Your Content in a Weblog Format.
Why You Should Stick to Design Conventions.
Working With Templates.
Writing for the Web.
GoogleSense
Making Money with Articles
Webhosting
RSS
Reading RSS Feeds with an RSS Aggregator