Comparing JavaScript’s switch to switch to VBScript’s Select Case
Data Types and Control Structures JavaScript
VBScript
1 while ( ( x == 1 ) ) 2 ++x;
1 0 ntil x = 1 2 x = x + 1 3 00
Comparing JavaScript’s while while to VBScript’s 0 ntil
JavaScript
VBScript
1 d0 2 ++x; 3 * while ( ( x == 1 ) );
1 0 2 x = x + 1 3 00 ntil x = 1
Comparing JavaScript’s d08while to VBScript’s 0 008ntil JavaScript VBScript 1 x = &; 2 f0r ( = 1; x; ++ ) 3 x 8= 2;
1 x = & 2 90r = 1 T0 x 3 x = x : 2 4 ext
Comparing JavaScript’s for to to VBScript’s For
Data Types Types and a nd Cont rol an d Control Structures ◦
◦
◦
◦
◦
Select Case/End Select Does not require break type type statement
VBScript structures without direct JavaScript equivalents: Do Until/Loop Do/Loop Until Loop until condition becomes True Exit Do mmediate e!it "rom Do hile/Loop# Do/Loop hile# Do Until/Loop or Do/Loop Until Exit !or mmediate e!it "rom !or/"ext !or loop $ptional Step %eyword to increment or decrement # $ %&Script ' !or y ( ' To ') Step ' * Call +sg&ox, -y -y ( - y 0 "ext
%&Script !unctions
&rede"ined "unctions ◦
Variant "unctions
1sE2pty
◦
)ath "unctions
◦
Cos# Sin# etc*
+a%e arguments in radians
radians , degrees
-./01
1nput&ox
◦
'eturns True i" variant not initiali(ed
Displays dialog in which user can input data
+sg&ox
Displays message dialog
◦
VBScript "unctions o"ten ta%e optional arguments
◦
2ormatting "unctions
!or2atCurrency# !or2atDateTi2e# etc*
%&Script !unctions ◦
2unctions "or getting in"o about scripting engine ScriptEngine 'eturns 33script4# 3%&Script4 or 3%&44 ScriptEngine&uild%ersion 'eturns current build version5 D number "or current release ScriptEngine+a5or%ersion 'eturns ma6or version number "or script engine ScriptEngine+inor%ersion 'eturns minor release number
Line continuation character 7nderscore character# 6 Statements cannot e!tend beyond current line without character ◦
◦
%&Script Exa2ple 7rogra2s
8lways place VBScript code inside 9+)L comments ◦
Script variables ◦
&revent code "rom being displayed as te!t in browsers that do not understand VBScript Variables declared outside o" procedures
Const %eyword ◦
Create constants
%&Script Exa2ple 7rogra2s
Comments ◦
Single quote 8;
◦
line continuation character# character# required i" statement e!tends beyond a line
7se as many as necessary
%&Script Exa2ple 7rogra2s
Calling "unctions ◦
" "unction call has arguments arguments in parentheses# use %eyword Call
" "unction assigns a variable# Call not needed a ( 4bs, <
" parentheses not used# %eyword Call not needed
2unction +sg&ox ◦
Displays message dialog
+sg&ox -%&Script is =un>- -9esults-9 esults◦
◦
Displays -%&Script is =un>- with -9esults- in the title bar $ptional argument to customi(e buttons and icon ignored
Thank you for interesting in our services. We are a non-profit group that run this website to share documents. We need your help to maintenance this website.