SetFocus在iPad上不起作用 [英] SetFocus does not work on iPad

查看:171
本文介绍了SetFocus在iPad上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们发现此代码适用于具有以下内容的PC:IE,Safari和FireFox。
但是在使用Safari的iPad或iPhone上,它不会自动关注文本框。
我们无法触摸屏幕并单击文本框,我们需要自动对焦。
这里有什么提示吗?

We found that this code works on a PC with: IE, Safari and FireFox. However on an iPad or iPhone with Safari it does not auto focus on a textbox. We cannot touch the screen and click the textbox, we need the auto focus. Any tips here?

谢谢!

<script language='JavaScript'>
<!--
function SetFocus()
{
    document.form1['txtCode'].focus();
}
window.onload = SetFocus;
// -->
</script>


推荐答案

不幸的是,似乎Mobile Safari不支持此行为,按设计。

Unfortunately, it appears Mobile Safari does not support this behaviour, by design.

http://www.quora.com/Mobile-Safari-iPhone-or-iPad-with-JavaScript-how-can-I-推出屏幕键盘

这篇关于SetFocus在iPad上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆