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


_IEFormElementRadioSelect

Set the value of a specified form element.

#include <IE.au3>
_IEFormElementRadioSelect(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 Radio Group
$f_select [необязательный] specifies whether element should be selected or deselected
-1 = Return selected state
0 = Unselect the element
1 = (по умолчанию) Select the element
$s_mode [необязательный] specifies search mode
byValue = (по умолчанию) value of the radio you wish to select
byIndex = 0-based index of radio 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 selected 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 a mandatory parameter for this function. Radio buttons are operated upon in groups sharing the same name. No more than one element within a group may be selected at a given time - when one item is selected, all others are deselected.

См. также

_IEFormElementOptionSelect, _IEFormElementCheckBoxSelect, _IEFormElementGetValue, _IEFormElementSetValue

Пример

; *******************************************************
; Пример 1 - Open a browser with the form example, get reference to form, select
;               each radio button byValue, then deselect the last item leaving none selected.
;               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
    _IEFormElementRadioSelect ($oForm, "vehicleAirplane", "radioExample", 1, "byValue")
    Sleep(1000)
    _IEFormElementRadioSelect ($oForm, "vehicleTrain", "radioExample", 1, "byValue")
    Sleep(1000)
    _IEFormElementRadioSelect ($oForm, "vehicleBoat", "radioExample", 1, "byValue")
    Sleep(1000)
    _IEFormElementRadioSelect ($oForm, "vehicleCar", "radioExample", 1, "byValue")
    Sleep(1000)
    _IEFormElementRadioSelect ($oForm, "vehicleCar", "radioExample", 0, "byValue")
    Sleep(1000)
Next

; *******************************************************
; Пример 2 - Open a browser with the form example, get reference to form, select
;               each radio button byIndex, then deselect the last item leaving none selected.
;               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
    _IEFormElementRadioSelect ($oForm, 3, "radioExample", 1, "byIndex")
    Sleep(1000)
    _IEFormElementRadioSelect ($oForm, 2, "radioExample", 1, "byIndex")
    Sleep(1000)
    _IEFormElementRadioSelect ($oForm, 1, "radioExample", 1, "byIndex")
    Sleep(1000)
    _IEFormElementRadioSelect ($oForm, 0, "radioExample", 1, "byIndex")
    Sleep(1000)
    _IEFormElementRadioSelect ($oForm, 0, "radioExample", 0, "byIndex")
    Sleep(1000)
Next