如何使 JavaScript focus() 在 Windows CE 6.0 的 IE 中为输入框工作
How to make JavaScript focus() work in IE of Windows CE 6.0 for input box
我一直在尝试让 Javascript focus() 在 Windows CE 6.0 的 Internet Explorer 中为输入框工作,但它不起作用。我到处搜索,尝试了不同的方法,但它在我的桌面环境中运行良好,但在 Windows CE 6.0 的 IE 中不起作用。
我已经尝试过摩托罗拉企业浏览器,CE 6.0 的 ZKBrowser,但没有任何运气。
以下是我试过的方法:
var myTableDiv2 = document.getElementById("myDynamicTable2");
var table1 = document.createElement('TABLE');
table1.border = '1';
var tableBody2 = document.createElement('TBODY');
table1.appendChild(tableBody2);
var tr = document.createElement('TR');
tableBody1.appendChild(tr);
var input = document.createElement('input');
input.type = "text";
input.setAttribute("size",'15');
input.setAttribute("value", '');
input.setAttribute("name", serial+'ItemCode');
input.setAttribute("autofocus",'True');
input.setAttribute("focus",'True');
input.onkeyup = function(){ValueChangedItem(this);};
var td = document.createElement('TD');
td.appendChild(input);
tr.appendChild(td);
myTableDiv2.appendChild(table1);
var inp = serial+'ItemCode';
var inputs = document.getElementsByName(inp);
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].name = serial+'ItemCode') {
// alert(inputs[1].name);
inputs[i].focus();
inp.focus();
break;
}
}
任何人都可以帮助我解决这个问题,我一直在努力解决但不能,下面的内容在桌面上运行得很好。
我通过以下代码让它工作:
var inputs1 = document.getElementById(serial+'ItemCode');
inputs1.focus();
inputs1.focus();
inputs1.focus();
我一直在尝试让 Javascript focus() 在 Windows CE 6.0 的 Internet Explorer 中为输入框工作,但它不起作用。我到处搜索,尝试了不同的方法,但它在我的桌面环境中运行良好,但在 Windows CE 6.0 的 IE 中不起作用。 我已经尝试过摩托罗拉企业浏览器,CE 6.0 的 ZKBrowser,但没有任何运气。
以下是我试过的方法:
var myTableDiv2 = document.getElementById("myDynamicTable2");
var table1 = document.createElement('TABLE');
table1.border = '1';
var tableBody2 = document.createElement('TBODY');
table1.appendChild(tableBody2);
var tr = document.createElement('TR');
tableBody1.appendChild(tr);
var input = document.createElement('input');
input.type = "text";
input.setAttribute("size",'15');
input.setAttribute("value", '');
input.setAttribute("name", serial+'ItemCode');
input.setAttribute("autofocus",'True');
input.setAttribute("focus",'True');
input.onkeyup = function(){ValueChangedItem(this);};
var td = document.createElement('TD');
td.appendChild(input);
tr.appendChild(td);
myTableDiv2.appendChild(table1);
var inp = serial+'ItemCode';
var inputs = document.getElementsByName(inp);
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].name = serial+'ItemCode') {
// alert(inputs[1].name);
inputs[i].focus();
inp.focus();
break;
}
}
任何人都可以帮助我解决这个问题,我一直在努力解决但不能,下面的内容在桌面上运行得很好。
我通过以下代码让它工作:
var inputs1 = document.getElementById(serial+'ItemCode');
inputs1.focus();
inputs1.focus();
inputs1.focus();