本文介绍了如何从组合框中找到一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我需要帮助才能从组合框中找到一个值,然后调用另一个名为removeshares的子例程来为该找到的值执行操作.
这是下面附带的代码.
Hi All,
I need help in finding a value from the combobox and then call another subroutine called removeshares to perform the action for that found value.
Here is the code attached below.
<html>
<head>
<title>Test</title>
<HTA:APPLICATION
ID="objNoTitleBar"
APPLICATIONNAME="Window Without a Title Bar"
SCROLL="No"
SINGLEINSTANCE="yes"
CAPTION="yes"
SysMenu="no"
ICON = "BIOHAZRD.ico"
>
</head>
<SCRIPT LANGUAGE="VBScript">
Sub Window_Onload
iTimerID = window.setInterval("ShowSplash",4000)
''self.Focus()
self.ResizeTo 650,425
End Sub
Sub CloseWindow
self.close
End Sub
Sub ShowSplash
Splash.Style.Display = "None"
Main.Style.Display = "Inline"
End Sub
Sub RunScript
If BasicCheckbox.Checked Then
strHTML= "<p align=''center''><font color=''black'' size=''3''><b>Updating....<br></font></p>"
self.setTimeout "RemoveShares", 9
Else
strHTML= "<p align=''center''><font color=''black'' size=''3''><b>Exiting....<br></font></p>"
self.close
End If
DataArea.InnerHTML = strHTML
End Sub
Sub MoveItem(oSource, oDestination)
Dim oListItem
If oSource.selectedIndex >= 0 Then
'' Create an variable to hold the item.
Set oListItem = oSource.options(oSource.selectedIndex)
'' Remove the item from the source list.
oSource.remove(oSource.selectedIndex)
'' Add the item to the destination list.
oDestination.add(oListItem)
End If
Call DisableButtons()
End Sub
Sub UpdateItem
''ddlBleh, ddlBlah
Dim MyArray(10)
Dim Search
Search = "1"
For i = 0 to (ddlBlah.Options.Length - 1)
strComputer = strComputer & ddlBlah.Options(i).Value & vbcrlf
Next
msgbox strComputer
Call UpdateItem1
Call International
End sub
Sub International
Dim intX
If ddlBlah.Text = "Red" Then Exit Sub
For intX = 0 To ddlBlah.ListCount - 1
If UCase(ddlBlah.Text) = UCase(ddlBah.List(intX)) Then
MsgBox "Item ''" & ddlBlah.Text & "'' is already in list."
Exit Sub
End If
Next
end sub
Sub UpdateItem1
For j = 0 to (ddlBleh.Options.Length - 1)
strK = strK & ddlBleh.Options(j).Value & vbcrlf
Next
msgbox strK
End sub
<br />
Sub DisableButtons()
If ddlBlah.options.length = 0 Then
btnAdd.disabled = True
Else
btnAdd.disabled = False
End If
If ddlBleh.options.length = 0 Then
btnRemove.disabled = True
Else
btnRemove.disabled = False
End If
End Sub
sub RemoveShares
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colShares = objWMIService.ExecQuery _
("Select * from Win32_Share where Type != 2147483648")
For Each objShare in colShares
objShare.Delete
Next
end sub
</SCRIPT>
<body STYLE="font:14pt arial; color:white;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0, StartColorStr=''#F5F5F5'', EndColorStr=''#D8BFD8'')">
<DIV id="Splash" STYLE="Height:275;Width:550;Border:0.1mm solid black;
position:relative;top:50;left:30;font:14pt arial;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr=''#00BFFF'', EndColorStr=''#ADD8E6'')
progid:DXImageTransform.Microsoft.dropshadow(OffX=10, OffY=10,
Color=''black'', Positive=''true'')">
<CENTER>
<br>
<br>
<br>
<font size="4" color="maroon">Test<br>
<br>
</font>
<font size="2" color="maroon">abc</font>
<br>
<br>
<br>
<img src="gears.gif">
</CENTER>
</DIV>
<DIV id="Main" STYLE="display:none;position:absolute">
<p></p>
<p></p>
<p align=center><font face="Arial" size="3" COLOR="black"><b>Hardening Settings</b></font></p>
<center>
<table border="0" cellpadding="2" cellspacing="1">
<tr valign="middle">
<td>
<select id="ddlBlah" class="ColorList" size="6">
<option value="1">Red
<option value="2">Green
<option value="3">Blue
<option value="4">Black
<option value="5">Gray
<option value="6">White
</select>
</td>
<td>
<button id="btnAdd" class="MoveButton" onclick="Call MoveItem(ddlBlah, ddlBleh)">Add -></button><br>
<br>
<button id="btnRemove" class="MoveButton" onclick="Call MoveItem(ddlBleh, ddlBlah)"><-Remove</button>
</td>
<td>
<select id="ddlBleh" class="ColorList" size="6">
</select>
</td>
</tr>
</table>
</center>
<input id=runbutton type="button" value="Quit" onClick="CloseWindow" STyle=''background-color: darkred;'' STyle=''color:white;''>
<input id=runbutton type="button" value="Update" onClick="UpdateItem" STyle=''background-color: darkred;'' STyle=''color:white;''>
<font face="arial" size="2">
<hr WIDTH ="600">
<span id = "DataArea"></span>
</font>
</body>
</html>
推荐答案
这篇关于如何从组合框中找到一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!