0

シンプルな形です

<div id="stylized" class="myform">
 <form id="mysmartform">
 <h1>CourtSmart Server Status</h1>
 <p>Are the servers running?</p>

<label>Yes
 <span class="small">All Servers Are Running</span>
 </label>
 <input type="radio" name="formradio" id="stylized" value="yes" />

<label>No
 <span class="small">We Have A Problem</span>
 </label>
 <input type="radio" name="formradio" id="stylized" value="no" />

<label>eMail
    <span class="small"></span>
</label>
<select name="formemail" size="1">
    <option value="someone@example.com" selected="selected">someone@example.com</option>
    <option value="someone@example.com">someone@example.com</option>
    <option value="someone@example.com">someone@example.com</option>
    <option value="someone@example.com">someone@example.com</option>
    <option value="someone@example.com">someone@example.com</option>
</select>


<button type="submit" id="sendReport">Send Status Report</button>
 <div class="spacer"></div>

VBScriptを使用して、選択したラジオボタンと選択した電子メールアドレスの値にアクセスし、単純なMsgBoxを実行して表示したい

4

2 に答える 2

1
Option Explicit
Dim objIE : Set objIE = CreateObject("InternetExplorer.Application")

objIE.Visible = False
objIE.Navigate "file://C:/form.html"
Do Until objIE.ReadyState = 4
WScript.Sleep 100
Loop

Dim value_running
Dim value_problem
Dim result

value_running = objIE.Document.getElementsByTagName("input").item(0).value
value_problem = objIE.Document.getElementsByTagName("input").item(1).value

If StrComp(value_running,"yes")=0 Then
    result = 0
ElseIf StrComp(value_problem,"yes")=0 Then
    result = 1
Else
    result = -1
End If

Wscript.Echo Result
于 2012-08-01T21:28:53.153 に答える
0

vbscriptを実行し、いくつかのGUIをIEに配置し、値を取得することを意味する場合は、次の例を参照してください。

Set web = CreateObject("InternetExplorer.Application") 
If web Is Nothing Then 
  msgbox("Error while loading Internet Explorer") 
  Wscript.Quit 
Else 
  with web 
    .Width = 300 
    .Height = 175 
    .Offline = True 
    .AddressBar = False 
    .MenuBar = False 
    .StatusBar = False 
    .Silent = True 
    .ToolBar = False 
    .Navigate "about:blank" 
    .Visible = True 
  end with 
End If 

'Wait for the browser to navigate to nowhere 
Do While web.Busy 
  Wscript.Sleep 100 
Loop 

'Wait for a good reference to the browser document 
Set doc = Nothing 
Do Until Not doc Is Nothing 
  Wscript.Sleep 100 
  Set doc = web.Document 
Loop 

'Write the HTML form 
doc.Write "Give me a name<br><form><input type=text name=name ><input type=button name=submit id=submit value='OK' onclick='javascript:submit.value=""Done""'></form>" 
Set oDoc = web.Document 
Do Until oDoc.Forms(0).elements("submit").Value <> "OK" 
  Wscript.Sleep 100 
  If web Is Nothing or Err.Number <> 0 Then 
    msgbox "Window closed" 
    Wscript.Quit 
  End If 
Loop 
name = oDoc.Forms(0).elements("name").value 
oDoc.close 
set oDoc = nothing 
web.quit 
set web = nothing 
Wscript.echo "Hello " & name 
于 2012-08-01T21:25:49.957 に答える