如何将iPhone文本字段集中到iPhone上(导致键盘出现)? [英] How do I focus an HTML text field on an iPhone (causing the keyboard to come up)?

查看:142
本文介绍了如何将iPhone文本字段集中到iPhone上(导致键盘出现)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个iPhone Web应用程序,并且我想在加载页面时自动对文本字段进行聚焦,从而启动键盘。通常的Javascript:

  input.focus(); 

似乎不起作用。任何想法?

那里...


它对你没有任何帮助,而是这个线程写道它是一个webkit引擎的bug。

我不知道它是否是一个已验证的bug ...



最后一篇文章后退机器(原始的看起来不起作用):


我正在使用纯XHTML MP / Ecmascript MP / WCSS开发我的应用程序。因此,使用本机平台浏览器控制API的
实际上不是
me的选项。是的,你提到的行为和我的一样。我在webkit.org的bugzilla中搜索了他的
主题,发现这确实是一个
报告的bug。焦点()到文本框确实会突出显示该元素,但
不会为其提供克拉供用户开始输入文本。
使用peppe@peppe.net提到的定时器也没有帮助。



这种行为在平台上很常见(S60,iphone,android)
使用webkit引擎。


所以截至目前我还没有看到这个问题的解决方案。



希望这可以帮助


I'm writing an iPhone web app, and I want to automatically focus a text field when the page is loaded, bringing up the keyboard. The usual Javascript:

input.focus();

doesn't seem to be working. Any ideas?

解决方案

Note: this answer is old and may not be relevant to newer versions out there...


It comes as no help to you but the last poster in this thread wrote that its a bug of the webkit engine.
I can't tell if its a verified bug or not...

Last post from way back machine (as original seems to not work):

I am developing my app in pure XHTML MP / Ecmascript MP / WCSS. So using native platform browser control api is really not an option for me. Yes the behaviour u mention is the same as mine. I searched his topic in the bugzilla at webkit.org and found that this indeed is a reported bug. focus() to a text box does highlight the element but does not provide a carat in it for the user to start entering text. Using a timer as mentioned by "peppe@peppe.net" does not help either.

This behaviour is common across platforms (s60,iphone,android) which use the webkit engine.

So as of now i dont see a solution to this problem.

Hope this helps

这篇关于如何将iPhone文本字段集中到iPhone上(导致键盘出现)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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