[Javascript] combining Javascript & VBscript
Peter Brunone
peter at brunone.com
Tue Mar 30 12:25:58 CST 2004
I use 'em together all the time in my intranet apps; it's the only way to fly (and yes, VBScript date handling rocks).
Nice typo! You can't plan things like that...
Peter
Original Message:
>From: Paul Novitski <paul at dandemutande.org>
>At 09:15 AM 3/30/2004, Chris T wrote:
>>Scripting languages are interchanged easily enough to where you can
>>call a JS function that in turn calls a VBScript function. What I don't know
>>is what would happen if you had 2 functions (one JS and one VB) by the same
>>name. I'm too lazy to find out though :)
>
>
>You lazy bum, get to work! (*crack*) Using two client scripting languages
>in the same page is something I've mused over but never taken the time to
>play with. In the attached demo, I tried two things with expected results:
>
>- IE 6.02:
>
>1) If the same function name is used by a Javascript block and a VBscript
>block, the function that is called by the document is the first one to
>occur on the page. In the attached script, I've put Javascript first so
>it's the one called. (Personally I wish this produced an error message, or
>could be controlled with something akin to ASP's Option Explicit directive
>to enforce uniqueness in the namespace.)
>
>2) A Javascript function can successfully call a VBscript function and vice
>versa.
>
>- Netscape 7.1:
>
>1) Javascript is run, VBscript is ignored.
>
>2) The call to the VBscript function from within Javascript triggers a
>runtime error.
>
>Of course, those who take practicality too seriously will ask why on earth
>one would want to use two scripting languages in the same page. Fussy,
>picky! Obviously, one reason would be if a programmer preferred to use one
>language but wanted to take advantage of features that occur in the other,
>for example Javascript's string methods or, gosh, I don't know, maybe
>VBscript's high-level date & time formatting.
>
>The main disadvantages I can see are a) the browser will have to load both
>interpreters, taking up several microseconds of my valuable time and
>megabytes of ram, and b) juggling two scripting languages in the same
>context would probably cause me to make more programming mistakes than I do
>already (*blanch*).
>
>Of course, any block of VBscript will be invisible to a non-IE browser,
>which conceivably could be turned to one's advantage in juggling browser
>discrapencies (what a great typo! I think I'll keep it).
>
>Paul
More information about the Javascript
mailing list