PDA

Click to See Complete Forum and Search --> : call another function from javascript


nmretd
Oct 25th, 2003, 06:14 AM
How can I call a Subroutine written in vb script from a Javascript Function.
EG,

<script language=javascript>
function ShowID(id)
{
alert ("ID is \n " + unescape(id));
runME(id);
}
</script>

Sub runME(sValue As String)
Response.Write(sValue)
End Sub

The above example does not work ?

CornedBee
Oct 26th, 2003, 05:04 AM
The Javascript is client-side, the VBScript is server-side. The two scripts are executed at completly different times and cannot interact.

nmretd
Oct 27th, 2003, 06:39 AM
I basically need to pick up a variable which is generated from a javascript function and use it in a vb sub. Is there any way I can do this ?

CornedBee
Oct 27th, 2003, 07:00 AM
Send a new request to the server.

nmretd
Oct 27th, 2003, 03:24 PM
can you please show me an example of this ?

CornedBee
Oct 27th, 2003, 03:38 PM
location.href="receiver.asp?var=value";

nmretd
Oct 28th, 2003, 06:11 AM
Thanks.

When the page is reloaded, how do I pick up this variable in my vb sub ?

CornedBee
Oct 28th, 2003, 09:57 AM
Like you do it in ASP. I have no idea, I don't do ASP.

vbNeo
Oct 28th, 2003, 10:21 AM
Just use Request

TheValue = Request("var")