I have been working on this problem for weeks.
I just want the script to pass the form data to itself when the button is
clicked and continue with the next function.


<----------------------------------------------------->
set objExplorer = CreateObject("InternetExplorer.Application")

Do While (objExplorer.Busy)
Loop
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 640
objExplorer.Height = 480
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
set objDocument = objExplorer.Document
objDocument.Open
objDocument.Writeln "<FORM NAME='Form1'>"
objDocument.Writeln "<B>Choose the areas you are interested in</B>"
objDocument.Writeln "<BR><INPUT TYPE=CHECKBOX NAME='chkIS'> Information
systems"
objDocument.Writeln "<BR><INPUT TYPE=CHECKBOX NAME='chkSE'> Systems
integration"
objDocument.Writeln "<BR><INPUT TYPE=CHECKBOX NAME='chkSA'> System
administration"
objDocument.Writeln "<BR><INPUT TYPE=CHECKBOX NAME='chkMgmt'> Management"
objDocument.Writeln "<BR><INPUT TYPE=BUTTON NAME='Button1'
VALUE='Continue'>"
objDocument.Writeln "</FORM>"
Sub Button1_onclick
Dim Selections, Count

Count = 0

If Form1.elements(0).checked = True Then
Selections = "Information systems"
Count = Count + 1
End If

If Form1.elements(1).checked = True Then
If Count <> 0 Then
Selections = Selections & ", "
End If
Selections = Selections & "Systems integrations"
Count = Count + 1
End If

If Form1.elements(2).checked = True Then
If Count <> 0 Then
Selections = Selections & ", "
End If
Selections = Selections & "System administration"
Count = Count + 1
End If

If Form1.elements(3).checked = True Then
If Count <> 0 Then
Selections = Selections & ", "
End If
Selections = Selections & "Management"
Count = Count + 1
End If

If Selections = "" Then
alert "You did not select any of the choices."
Else
alert "You checked the following choice(s): " & Selections
End If
End Sub



<----------------------------------------------------->

Re: can U make this button work by Michael

Michael
Tue Jan 20 20:13:54 CST 2004

mishkare wrote:
> I have been working on this problem for weeks.
> I just want the script to pass the form data to itself when the
> button is clicked and continue with the next function.
>


Take a look at this thread...

Google Groups: View Thread "How to catch onClick-events from HTML-page in
WSH-sc..."
http://groups.google.com/groups?th=beb938a38b7e133c



>
> <----------------------------------------------------->
> set objExplorer = CreateObject("InternetExplorer.Application")
>
> Do While (objExplorer.Busy)
> Loop
> objExplorer.Navigate "about:blank"
> objExplorer.ToolBar = 0
> objExplorer.StatusBar = 0
> objExplorer.Width = 640
> objExplorer.Height = 480
> objExplorer.Left = 0
> objExplorer.Top = 0
> objExplorer.Visible = 1
> set objDocument = objExplorer.Document
> objDocument.Open
> objDocument.Writeln "<FORM NAME='Form1'>"
> objDocument.Writeln "<B>Choose the areas you are interested in</B>"
> objDocument.Writeln "<BR><INPUT TYPE=CHECKBOX NAME='chkIS'>
> Information systems"
> objDocument.Writeln "<BR><INPUT TYPE=CHECKBOX NAME='chkSE'> Systems
> integration"
> objDocument.Writeln "<BR><INPUT TYPE=CHECKBOX NAME='chkSA'> System
> administration"
> objDocument.Writeln "<BR><INPUT TYPE=CHECKBOX NAME='chkMgmt'>
> Management" objDocument.Writeln "<BR><INPUT TYPE=BUTTON NAME='Button1'
> VALUE='Continue'>"
> objDocument.Writeln "</FORM>"
> Sub Button1_onclick
> Dim Selections, Count
>
> Count = 0
>
> If Form1.elements(0).checked = True Then
> Selections = "Information systems"
> Count = Count + 1
> End If
>
> If Form1.elements(1).checked = True Then
> If Count <> 0 Then
> Selections = Selections & ", "
> End If
> Selections = Selections & "Systems integrations"
> Count = Count + 1
> End If
>
> If Form1.elements(2).checked = True Then
> If Count <> 0 Then
> Selections = Selections & ", "
> End If
> Selections = Selections & "System administration"
> Count = Count + 1
> End If
>
> If Form1.elements(3).checked = True Then
> If Count <> 0 Then
> Selections = Selections & ", "
> End If
> Selections = Selections & "Management"
> Count = Count + 1
> End If
>
> If Selections = "" Then
> alert "You did not select any of the choices."
> Else
> alert "You checked the following choice(s): " & Selections
> End If
> End Sub
>
>
>
> <----------------------------------------------------->

--
Michael Harris
Microsoft.MVP.Scripting

Windows 2000 Scripting Guide
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

TechNet Script Center Sample 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


Re: can U make this button work by mishkare

mishkare
Thu Jan 22 20:21:12 CST 2004

That worked great.
Should I use the same method to create the checkboxes?
Where can I learn more about the 'AppendElement' and 'AppendChild' commands?
I was able to use the example and create this function,
<----------------------->
function continueclick() ' create the button
With objExplorer
Set IEButton = .Document.createElement("input")
IEButton.type = "button"
IEButton.value = "ClickMe"
.Document.Body.appendChild IEButton
set IEButton.onclick = getref("ItWasClicked")
End With
End Function
Do: WScript.Sleep 20: Loop
Sub ItWasClicked
' IEButton's onClick hooks to this sub via the GetRef
MsgBox "I was clicked!"
End Sub
Sub IE_onQuit
' This makes the script quit when IE is closed
WScript.Quit
End Sub
<---------------------------------->