Click to See Complete Forum and Search --> : HTML to VBScript


JediKnight
July 27th, 2007, 12:11 PM
Hi,
Sorry for the easy question, but does anyone have an example of this process :-

(1) simple HTML where I can enter a value in an input box
(2) The HTML calls some VBScript and the VBScript displays the value in a message box.
(3) The VBScript then displays another input box for me to enter a value in a NEW variable (defined in the VBScript).
(4) The VBScript ends and my HTML displays the NEW value just entered in VBScript


I'm hoping that this can be done in very few lines and shows me how to pass values between code types.

PeejAvery
July 27th, 2007, 02:44 PM
I'm on vacation and don't have access to a PC, so for now, by best advice is to start here (http://w3schools.com/vbscript/default.asp). Since VBScript is IE only, I cannot write much with my Mac.

HanneSThEGreaT
July 28th, 2007, 05:43 AM
JediKnight, this will get you started :)

<HTML>
<HEAD>
<TITLE>Input Boxes</TITLE>
</HEAD>

<BODY>
<SCRIPT LANGUAGE="VBScript">
<!--
Dim MyName 'First name enterd
Dim MyNewName 'Second name entered

Sub window_onload() 'When page Load s

MyName = InputBox("What is your nameż", "Simple question", "Put your name here") 'Enter firts

name via inputbox

Call DisplayName 'call DisplayName function

End Sub

Sub DisplayName() 'This function displays the name in a Messagebox
MsgBox MyName 'Show messagebox

Call NewName 'call the NEwName function
End Sub


Sub NewName() 'This function asks for another name, also via inputbox
MyNewName = InputBox("Enter Your Second Name.", "Simple question", "Put your name here") 'ask new

name

Call Result 'call the Result sub

End Sub

Sub Result 'this function writes the new name onto the webpage's body
Document.write(MyNewName) 'write the new name
End Sub
-->
</SCRIPT>
</BODY>
</HTML>

JediKnight
July 30th, 2007, 07:18 AM
Great, thank for this - its a good start. Thanks for your time and effort.