我想根据他们的安排专注于文本框....我的问题是根据我的代码它直接关注第三个文本框..但我想根据 texbox 的排列来关注...例如如果第一个文本框是空白的然后它将专注于第一个文本框,目前它专注于第三个文本框......
<input type="text" id="txtFirst"/>
<input type="text" id="txtSecond"/>
<input type="text" id="txtThird"/>
<input type="button" onclick="check()" value="Check" />
<script>
function check() {
var err = "";
var first = document.getElementById("txtFirst");
var second = document.getElementById("txtSecond");
var third = document.getElementById("txtThird");
if (first.value == "") {
first.focus();
err = err + "enter the first value";
} if (second.value == "") {
second.focus();
err = err + "enter the second value";
} if (third.value == "") {
third.focus();
err = err + "enter the third value";
} }
</script>