uses
MSHTML;
procedure TForm1.Button1Click(Sender: TObject);
var
Document: IHTMLDocument2;
rbTestList: IHTMLElementCollection;
rbTest: IHTMLOptionButtonElement;
I: Integer;
begin// Get a reference to the document // Referenz auf Dokument
Document := WebBrowser1.Document as IHTMLDocument2;
// Get a reference to input-control (Radiobutton) // Referenz auf Eingabe-Control-Element (Radiobutton)
rbTestList := Document.all.item("rating", EmptyParam) as IHTMLElementCollection;
// Get current values. // Aktuellen Wert auslesen for I := 0 to rbTestList.Length - 1 dobegin// reference to the i. RadioButton // Referenz auf i. RadioButton
rbTest := rbTestList.item(I, EmptyParam) as IHTMLOptionButtonElement;
// Show a message if radiobutton is checked // Anzeigen, wenn dieser RadioButton ausgewahlt if rbTest.Checked then
ShowMessageFmt("Der RadioButton mit dem Wert %s" +
" ist ausgewahlt!", [rbTest.Value]);
end;
// Set new values // Neuen Wert setzen for I := 0 to rbTestList.Length - 1 dobegin// reference to the i. RadioButton // Referenz auf i. RadioButton
rbTest := rbTestList.item(I, EmptyParam) as IHTMLOptionButtonElement;
// check radiobutton with value 3. // Wir mochten den RadioButton mit dem Wert "3" aktivieren if rbTest.Value = "3" then
rbTest.Checked := True;
end;
end;
Если Вас заинтересовала или понравилась информация по разработке на Delph - "Получить доступ к радио кнопкам в TWebBrowser", Вы можете поставить закладку в социальной сети или в своём блоге на данную страницу: Так же Вы можете задать вопрос по работе этого модуля или примера через форму обратной связи, в сообщение обязательно указывайте название или ссылку на статью!