Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
See what I mean? This is a pretty representative sample of the differences (a<br />
'for' block would provide a more extreme example). To put it simply,<br />
JavaScript looks 'code-like', with all kinds of brackets and semicolons all over<br />
the place – and it's all-too-easy to forget one. VBScript, on the other hand, is<br />
designed to be more human, and closer to natural language. While its<br />
approach is less flexible for complicated operations, it's much quicker for<br />
simpler ones.<br />
Useful VBScript Functions.<br />
Here are a few of the functions VBScript has that you'll be wishing you could<br />
use in JavaScript.<br />
DateDiff. Works out the difference between two dates – this is a nightmare<br />
in most programming languages.<br />
FormatCurrency. Takes a number and formats it as whatever currency you<br />
want.<br />
InStr. Looks for some text in a string, and stops when it finds it. Useful for<br />
including text up to a special 'stop' phrase.<br />
Split. Divides some text up into an array depending on where a certain<br />
character is (similar to PHP's explode command, and just as useful).<br />
Replace. Lets you look through some text and replace every instance of a<br />
certain character or phrase.<br />
Apart from this, VBScript offers quite a few of JavaScript's functions. Even<br />
though that's useful, it can sometimes make you feel like you're just writing<br />
JavaScript in an odd way – the same way that doing anything complex with<br />
desktop Visual Basic gradually seems to turn into writing a kind of C with a<br />
slightly different layout. If you keep things simple, though, VBScript is good<br />
at what it does.<br />
So What's the Catch?<br />
Well, the catch is a big one. Pages written using VBScript won't work in any<br />
web browser other than Internet Explorer – it's Microsoft's own language,<br />
The Web Design Guide for Newbies |81