↑  ←  Описание функции


_IEFormElementCheckBoxSelect

Set the value of a specified form element.

#include <IE.au3>
_IEFormElementCheckBoxSelect(ByRef $o_object, $s_string [, $s_name = "" [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]]])

Параметры

$o_object Переменная объекта InternetExplorer.Application, Form object
$s_string Value used to match element - treatment based on $s_mode
$s_name [необязательный] Name or Id of checkbox(es)
$f_select [необязательный] specifies whether element should be checked or unchecked
-1 = Return checked state
0 = Uncheck the element
1 = (по умолчанию) Check the element
$s_mode [необязательный] specify search mode
byValue = (по умолчанию) value of the checkbox you wish to select
byIndex = 0-based index of checkbox you wish to select
$f_fireEvent [необязательный] specifies whether to fire OnChange and OnClick events after changing value
0 = do not fire OnChange or OnClick event after setting value
1 = (по умолчанию) fire OnChange and OnClick events after setting value

Возвращаемое значение

Успех:If $f_select = -1, returns the current checked state, else returns 1
Ошибка:Возвращает 0 и устанавливает @error
@error:0 ($_IEStatus_Success) = Нет ошибок
3 ($_IEStatus_InvalidDataType) = Неверный тип данных
4 ($_IEStatus_InvalidObjectType) = Неверный тип объекта
5 ($_IEStatus_InvalidValue) = Неверное значение
7 ($_IEStatus_NoMatch) = Нет совпадений
@extended:Содержит номер неверного параметра

Примечания

The $f_fireEvent parameter is significant only if the form element has an onChange event associated with it.

$s_Name is optional for this function. If it is omitted, the function will operate on a collection of all <input type=checkbox> elements in the form. If specified, the function will operate on a collection of <input type=checkbox> elements with that name.

См. также

_IEFormElementOptionSelect, _IEFormElementRadioSelect, _IEFormElementGetValue, _IEFormElementSetValue

Пример

; *******************************************************
; Пример 1 - Open a browser with the form example, get reference to form, select and
;               deselect the checkboxes byValue.  Since $s_Name is not specified, operate
;               on the collection of all <input type=checkbox> elements in the form
;               Note: You will likely need to scroll down on the page to see the changes
; *******************************************************

#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
    _IEFormElementCheckboxSelect ($oForm, "gameBasketball", "", 1, "byValue")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, "gameFootball", "", 1, "byValue")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, "gameTennis", "", 1, "byValue")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, "gameBaseball", "", 1, "byValue")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, "gameBasketball", "", 0, "byValue")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, "gameFootball", "", 0, "byValue")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, "gameTennis", "", 0, "byValue")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, "gameBaseball", "", 0, "byValue")
    Sleep(1000)
Next

; *******************************************************
; Пример 2 - Open a browser with the form example, get reference to form, select and
;               deselect the checkboxes byIndex.  Since $s_Name is not specified, operate
;               on the collection of all <input type=checkbox> elements in the form
;               Note: You will likely need to scroll down on the page to see the changes
; *******************************************************

#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
    _IEFormElementCheckboxSelect ($oForm, 3, "", 1, "byIndex")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, 2, "", 1, "byIndex")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, 1, "", 1, "byIndex")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, 0, "", 1, "byIndex")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, 3, "", 0, "byIndex")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, 2, "", 0, "byIndex")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, 1, "", 0, "byIndex")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, 0, "", 0, "byIndex")
    Sleep(1000)
Next

; *******************************************************
; Пример 3 - Open a browser with the form example, get reference to form, select and
;               deselect the checkboxes byIndex in the group that shares the name checkboxG2Example
;               Note: You will likely need to scroll down on the page to see the changes
; *******************************************************

#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
    _IEFormElementCheckboxSelect ($oForm, 0, "checkboxG2Example", 1, "byIndex")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, 1, "checkboxG2Example", 1, "byIndex")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, 0, "checkboxG2Example", 0, "byIndex")
    Sleep(1000)
    _IEFormElementCheckboxSelect ($oForm, 1, "checkboxG2Example", 0, "byIndex")
    Sleep(1000)
Next