HTML上のコンボボックスのListIndexを指定する

解決


コンボ  2004-03-25 07:27:36  No: 82707  IP: [192.*.*.*]

Dim objTable as Object
                Set objTable = .Document.frames(1).frames(2).Document.getElementsByTagName("TABLE")
                With Combo1
                    For i = 0 To objSelect(1).Options.length - 1
                        .AddItem objSelect(1).Options(i).innerText
                    Next
                      (ここの処理)
                End With

HTML上のコンボボックスからVB上のコンボボックスにデータを取得し、そのListIndexを指定したいのですが、わかりません。

編集    削除
魔界の仮面弁士  2004-03-25 18:05:41  No: 82708  IP: [192.*.*.*]

> Dim objTable as Object
> Set objTable = .Document.frames(1).frames(2).Document.getElementsByTagName("TABLE")
objTableを利用している部分が書かれていないようですが…。

> For i = 0 To objSelect(1).Options.length - 1
変数 objSelect というのは、SELECTエレメントの事でしょうか?

> そのListIndexを指定したいのですが
VBのComboBoxコントロールでは、選択項目をListIndexプロパティで指定しますが、
HTMLの単一選択SELECTエレメントでは、選択項目をselectedIndexプロパティで指定します。

編集    削除
コンボ  2004-03-25 20:36:15  No: 82709  IP: [192.*.*.*]

Dim objSelect as Object
    Set objSelect = .Document.frames(1).frames(2).Document.getElementsByTagName("SELECT")
                With Combo1
                    For i = 0 To objSelect(1).Options.length - 1
                        .AddItem objSelect(1).Options(i).innerText
                    Next
                      ★objSelect(1).SelectedIndex
                End With
★で解決しました。ありがとうございます!

編集    削除
コンボ  2004-05-21 20:31:16  No: 82710  IP: [192.*.*.*]

以前解決させてもらったスレッドに上乗せしています。

<select multiple>

とコンボボックスのチェックボックスタイプで処理をしたいのですが、
Set objSelect = WebBrowser.Document.getElementsByTagName("SELECT")
  objSelect(0).SelectedIndex = Combo.ListIndex(他にMultiSelect、いずれもエラーはでませんが、動作しません。)

自分なりにはobjSelect(0).SelectedIndexのSelectedIndexプロパティが違うと思うのですが、他のプロパティがあるのでしょうか?

編集    削除
魔界の仮面弁士  2004-05-23 04:47:49  No: 82711  IP: [192.*.*.*]

SELECT要素のselectedIndexプロパティ … 選択された先頭項目を示します
http://www.microsoft.com/japan/developer/library/jpisdk/dhtml/references/properties/selectedIndex.htm

OPTION要素のselectedプロパティ … その項目が選択されているかを示します。
http://www.microsoft.com/japan/developer/library/jpisdk/dhtml/references/properties/selected.htm#selected

編集    削除