選択を送信した後に次のページの情報を変更する複数のドロップボックス メニューを同じページに表示しようとしています。
そのため、ユーザーはメニューからさまざまな複数の選択を行い、[送信] をクリックすると、さまざまな情報が次のページに表示され、以下のスクリプトのように同じページには表示されません。
これは私が見つけた最も近いものですが、代わりに次のページの情報を取得しようとするのは難しいことがわかっています.
<form>
<table>
<tr>
<td>Person 1</td>
<td>Information</td>
<td>
<select id="choice1" onchange="changeText('choice1', 'display1')">
<option>Select</option>
<optgroup label="Category 1">
<option>G1 Choice1</option>
<option>G1 Choice2</option>
</optgroup>
<optgroup label="Category 2">
<option>G2 Choice1</option>
<option>G2 Choice2</option>
</optgroup>
</select>
</td>
</tr>
<tr>
<td>Person 2</td>
<td>Information</td>
<td>
<select id="choice2" onchange="changeText('choice2', 'display2')">
<option>Select</option>
<optgroup label="Category 1">
<option>G1 Choice1</option>
<option>G1 Choice2</option>
</optgroup>
<optgroup label="Category 2">
<option>G2 Choice1</option>
<option>G2 Choice2</option>
</optgroup>
</select>
</td>
</tr>
</table>
<p> </p>
<table>
<tr>
<td><div id="display1">Select an option</div></td>
</tr>
<tr>
<td><div id="display2">Select an option</div></td>
</tr>
</table>
<p> </p>
</form>
<script>
var textBlocks = [
'Select an option',
'G1 Choice1 description',
'G1 Choice2 description',
'G2 Choice1 description',
'G2 Choice2 description'
];
function changeText(elemid, displayId) {
var ind = document.getElementById(elemid).selectedIndex;
document.getElementById(displayId).innerHTML = textBlocks[ind];
}
</script>
</body>
</html>