ø 对autocomplete()的补充
对autocomplete() 方法补充一下,我们先到可自动完成的文本框标记中看一下(译者注:<input type=text>),autocomplete()方法将给出三个参数:作用于的文本框的对象otextbox对象,event(事件)对象。调用方法如下:
<input type=”text” onkeyup=”return autocomplete(this, event, arrvalues)” />
考虑到在文本框中触发onkeypress事件(译者更正:应该使用onkeyup事件,以保证字符已被输入)的第一个键的键码:
function autocomplete(otextbox, oevent, arrvalues) {
switch (oevent.keycode) {
...
}
}
有许多按键需要被屏蔽,如光标键,只需要在下面指定的case语句中返回true
function autocomplete(otextbox, oevent, arrvalues) {
switch (oevent.keycode) {