invoking a vbscript function?

Results 1 to 3 of 3

Thread: invoking a vbscript function?

  1. #1
    Jeff Newhart Guest

    Default invoking a vbscript function?

    Is it possible to invoke a vbscript function from an input device such as a radio button or a button? <BR><BR>&#060;input type="Button" name="button1" value="Push Me" onclick="vbfunc1()"&#062;<BR><BR>Thanks. Help appreciated.<BR>

  2. #2
    Jason Buck Guest

    Default RE: invoking a vbscript function?

    Give this a try and let me know if it was what you are looking for.<BR><BR>Notice the Function line. MYFORM is the name of your FORM and OnSUBMIT is the action when the BUTTON is pushed.<BR><BR>Hence MyForm_OnSubmit<BR><BR>Feel free to contact with any further questions.<BR>Respectfully,<BR><BR>Jason<BR>webmas ter@wnj.com<BR><BR>&#060;SCRIPT LANGUAGE="VBScript"&#062; <BR><BR>Option Explicit<BR><BR>dim validation<BR><BR>dim header<BR><BR>header = "VB Function"<BR><BR>Function MyForm_OnSubmit<BR>validation = True<BR><BR>If len(Document.MyForm.fieldUser.Value) = 0 Then<BR>MsgBox "You must enter a name",8, Header<BR><BR>validation = False<BR><BR>End If<BR><BR><BR>If validation = True Then<BR>MyForm_OnSubmit = True<BR><BR>Else<BR><BR>MyForm_OnSubmit = False<BR><BR>End If<BR><BR>End Function<BR><BR>&#060;/SCRIPT&#062;<BR><BR><BR>&#060;html&#062;<BR>&#060; head&#062;&#060;title&#062; VB Function &#060;/title&#062;<BR>&#060;meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"&#062;<BR><BR>&#060;/head&#062;<BR>&#060;body&#062;<BR><BR>&#060;form NAME="Myform"&#062;<BR>&#060;input type="text" name="fieldUser"&#062;<BR><BR>&#060;input type="submit" value="Submit" name="submit"&#062;&#060;input type="reset" value="Reset" name="b2"&#062;<BR>&#060;/form&#062;<BR>&#060;/body&#062;<BR>&#060;/html&#062;

  3. #3
    Jason Buck Guest

    Default RE: invoking a vbscript function?

    I was just on the Microsoft site and stumbled across this. They did it a little different then I but the same Idea all in all.<BR><BR>&#060;HTML&#062;<BR>&#060;HEAD&#062;&# 060;TITLE&#062;Simple Validation&#060;/TITLE&#062;<BR>&#060;SCRIPT LANGUAGE="VBScript"&#062; <BR>&#060;!--<BR>Sub Button1_OnClick<BR> Dim TheForm<BR> Set TheForm = Document.ValidForm<BR> If IsNumeric(TheForm.Text1.Value) Then<BR> If TheForm.Text1.Value &#060; 1 Or TheForm.Text1.Value &#062; 10 Then<BR> MsgBox "Please enter a number between 1 and 10."<BR> Else<BR> MsgBox "Thank you."<BR> End If<BR> Else<BR> MsgBox "Please enter a numeric value."<BR> End If<BR>End Sub<BR>--&#062;<BR>&#060;/SCRIPT&#062;<BR>&#060;/HEAD&#062;<BR>&#060;BODY&#062;<BR>&#060;H3&#062;Si mple Validation&#060;/H3&#062;&#060;HR&#062;<BR>&#060;FORM NAME="ValidForm"&#062;<BR>Enter a value between 1 and 10: <BR>&#060;INPUT NAME="Text1" TYPE="TEXT" SIZE="2"&#062;<BR>&#060;INPUT NAME="Button1" TYPE="BUTTON" VALUE="Submit"&#062;<BR>&#060;/FORM&#062;<BR>&#060;/BODY&#062;<BR>&#060;/HTML&#062;<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •