Everest Computers Blog About Computers and Web Design

Today I figured out that it is actually possible to have Javavscript functions and VBScript functions on one page and it is also possible to call a VBScript function from a JavaScript function. Previously, I didn’t think it’s possible - scripting geeks, please forgive me.

The call can be made as simply as described in the code below:

<script language = “javascript”>

function fnJavaFunction()

{

var strVar;

strVar = fnVBFunction();

//Next line writes “Result”

document.write(strVar);

}

</script>

<script language=”vbscript”>

function fnVBFunction()

dim strResult

strResult = “Result”

‘Next line stores result of the VBScript function

fnVBFunction = strResult

end Function

</script>

6 Responses to “JavaScript and VBScript functions on one web page calling each other”

  1. Mickey Kick

    Thanx for this it really helped me a lot i think combining java and VB is awesome task and not so hard to do comparing to other languages.

  2. .Net Development

    Very good function example. I could use that from time to time for sure.

  3. Mens Tuxedos

    Thank you for the good example. It helped me a lot. I look forward to see more examples in future.

  4. Marble Host

    Thanks for tips
    I have written a couple function in Java script in my index
    Now I want to use these function in my other pages without cutting and pasting the code in each of the pages.I write Is there way to call these Java script function form an index an external file just like CSS code we call from external file
    Any help would be apprecated
    Thanks

  5. George

    @Marble Host: All you need to do is to put your shared javascript file something.js into the accessible directory and in all files that access javascript functions from this file add a line

    [Please you your real name next time when writing a comment or write something like "YourName - Owner of Marble Host"].

  6. Flash actionscript developer

    Hi George,

    Pretty much coding example, as of your good example i got rid off from fear of Java scripting side code..

 
Powered by WordPress |  Admin
Copyright © 2007 - 2009 Everest Computers: Computer Support & Web Design. All rights reserved.