interviews.dotnetthread.com

↑ Grab this Headline Animator

Sunday, May 24, 2009

Calling VB Script Function from inside a Javascript function.

Calling VB script function in javascript is as simple as calling another javascript function.

Let us see with a simple example.
First we will create a function in VB Script to add two numbers.

Call this VB Script function from javascript

Following is html page to input values to add and shows the result in other


<html>

<head>

<script language="VbScript">



Function Add(a,b)

Add=CInt(a)+CInt(b)

End Function



</script>



<script language="JavaScript">



function callingVbfun()

{

document.getElementById('txtResult').value= Add(document.getElementById('txtNumber1').value,document.getElementById('txtNumber2').value)

}



</script>

</head>

<body></body>

<form>

<input type-"text" id="txtNumber1"/>

<input type-"text" id="txtNumber2"/>

<input type-"text" id="txtResult"/>

<input type-"button" id="btn" value="Add" onclick="callingVbfun()"/>

</form>

</html>

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.

 

Latest Articles