我正在尝试在设备就绪的cordova中更改表单的tabindex。 我添加了一些蜂鸣声,以查看代码是否有效并且蜂鸣声还可以。
表单开始于ElementById(“ codigo”)
if (arr[2]==0) {
document.getElementById("quantidade").tabIndex = "1";
document.getElementById("codigo").tabIndex = "2";
navigator.notification.beep(2);
} else {
document.getElementById("quantidade").tabIndex = "2";
document.getElementById("codigo").tabIndex = "1";
navigator.notification.beep(5);
}
HTML中表单的代码
<form id="my-form">
<button type="submit" class="div-red botao float-right">inserir</button>
<div class="div-red botao float-right" onclick="goLocaliza(0);" >localiza</div>
<input class="float-right" onClick="this.select();" type="number" value="" id="quantidade" maxlength="3" style="width: 10%;" value="0" required>
<input class="float-right" onClick="this.select();" type="text" value="" id="codigo" maxlength="14" autofocus="autofocus" style="width: 40%;" required>
</form>