私は多くのフィールドを持つフォームを持っており、すべての入力を与え、タブインデックス番号を選択してボタンを押しています。それはうまくいきますが、プログラムでやりたいと思います。
各列にグループがある2列のレイアウトがあるため、デフォルトのtabindexの順序は正しくありません。グループごとにトップダウンで行きたいです。含まれているdivに基づいてすべての入力、選択、ボタンタグにtabindex番号を割り当てるように、body.onload関数を作成するにはどうすればよいですか?たとえば、最初に循環させたいdivの場合、すべてのinput tabindex=1
、select、およびbuttonタグにを含めることができ、2番目のdivのすべてのinput、select、およびbuttonタグにを含めることができますtabindex=2
。
ありがとう!
これが簡単な例です
<style>
.a { display: inline-block;
width:200px;
border: 1px solid black;
}
</style>
<div class="a">
<div id="Div01" title="these inputs should have tabindex=1">
<p>Div 01</p>
<input id="Div01Field1" type="text" value="Me first"/>
<input id="Div01Field3" type="text" value="Me second"/>
<input id="Div01Field2" type="text" value="Me third"/>
<hr>
</div>
<div id="Div03" title="these inputs should have tabindex=3">
<p>Div 03</p>
<input id="Div03Field1" type="text" value="Me seventh"/>
<input id="Div03Field2" type="text" value="Me eighth"/>
<input id="Div03Field3" type="text" value="Me ninth"/>
<hr>
</div>
<div id="Div05" title="these inputs should have tabindex=5">
<p>Div 05</p>
<input id="Div05Field1" type="text" value="Me thirteenth"/>
<input id="Div05Field2" type="text" value="Me fourteenth"/>
<input id="Div05Field3" type="text" value="Me fifteenth"/>
</div>
</div>
<div class="a">
<div id="Div02" title="these inputs should have tabindex=2">
<p>Div 02</p>
<input id="Div02Field1" type="text" value="Me fourth"/>
<input id="Div02Field2" type="text" value="Me fifth"/>
<input id="Div02Field3" type="text" value="Me sixth"/>
<hr>
</div>
<div id="Div04" title="these inputs should have tabindex=4">
<p>Div 04</p>
<input id="Div04Field1" type="text" value="Me tenth"/>
<input id="Div04Field2" type="text" value="Me eleventh"/>
<input id="Div04Field3" type="text" value="Me twelfth"/>
<hr>
</div>
<div id="Div06" title="these inputs should have tabindex=6">
<p>Div 06</p>
<input id="Div06Field1" type="text" value="Me sixteenth"/>
<input id="Div06Field2" type="text" value="Me seventeenth"/>
<input id="Div06Field3" type="text" value="Me eighteenth"/>
</div>
</div>