Michael
Sat Aug 23 11:54:32 CDT 2003
KLomax wrote:
> I am trying the execute a VBscript function from an anchor
> tag, but seem to be unable to get the syntax correct.
> Following is a simple web page that diplays a msgbox.
> It works from the button, but not from the Anchor.
> Can you you help me?
>
> <HTML>
> <INPUT id="cmdWrite" onclick="vbscript:WriteFile('Hello')"
> type="button" value="Write File"><BR><BR>
> <A HREF="vbscript:WriteFile('Hello')">Say Hello</A>
> <SCRIPT LANGUAGE=VBSCRIPT>
> Sub WriteFile(Value)
> Msgbox "Value=" & Value
> End Sub
> </SCRIPT>
> </HTML>
<HTML>
<INPUT id="cmdWrite"
onclick='vbscript:WriteFile("Hello")'
type="button"
value="Write File">
<BR><BR>
<A HREF=""
onclick='vbscript:WriteFile("Hello")'>Say Hello
</A>
<SCRIPT LANGUAGE=VBSCRIPT>
Sub WriteFile(Value)
Msgbox "Value=" & Value
window.event.returnValue = False
End Sub
</SCRIPT>
</HTML>
--
Michael Harris
Microsoft.MVP.Scripting
Windows 2000 Scripting Guide
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp
System Administration Scripting Guide - samples scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942
WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en