Click to See Complete Forum and Search --> : Calling VBScript Sub from a Link


ScaryBinary
August 26th, 2002, 03:53 PM
Hi Gurus,

I would like to call a VBScript Sub from an HTML link. Using Javascript this was a breeze....

<A HREF="javascript:someFunction()">Call it!</A>

How can I do the same thing using VBScript? I've tried writing an onclick event handler, but then I'm still forced to put something in the HREF property to make it function like a link. I want the text to be displayed as a link, but I want the function to be called instead of displaying a new page.

Thanks!

websmith99
September 24th, 2002, 03:24 PM
How about making the link a button?

<HTML>
<HEAD>
<script language="vbscript">

sub button1_onclick ( )
msgbox ( "Button was pressed." )
end sub

</script>
</HEAD>
<BODY>
<INPUT TYPE="button" NAME="button1" VALUE="Call it!">
</BODY>
</HTML>