簡體   English   中英

iPhone-使用java / html / css / javascript自動在表單上彈出鍵盤嗎?

[英]iphone - automatically pop up keypad on a form with java/html/css/javascript?

我有一個表單,我希望用戶填寫該表單,並且希望他們在敲JSP頁面時自動將小鍵盤彈出到iphone上,而不是先敲擊輸入框。 為了達到這個目的,特殊標簽是什么? (請注意,這不是一個客觀的C應用程序)

另外,可以設置一個計時器,例如:3秒,然后彈出鍵盤,而不是立即彈出。

提前致謝。

應該自動為HTML頁面輸入字段(在輸入字段時)完成操作,從而調用YourFormElement.focus(); YourFormElement.select(); 應該管用。

特別是,您可以利用HTML5並指定以下內容:

<input type="number"/> <!-- opens the keyboard in number mode -->

這也不會破壞任何內容,因為瀏覽器無法將“數字”理解為類型,而默認使用“文本”。

注意:要進行此設置,有多種可能性(但這是一個簡單的示例):

HTML:

<input id="yourIDgoesHere"/>

Vanilla JavaScript(在顯示字段之后):

<script type="text/javascript">
  document.getElementById('yourIDgoesHere').focus();
</script>

使用jQuery:

<script type="text/javascript">
  $(document).ready(function(){
    $('#yourIDgoesHere').focus();
  });
</script>

我認為如果沒有用戶先點擊該框就不可能做到這一點,但是您可以使用Javascript為他們選擇框,這應該為用戶打開小鍵盤。

即onload:

document.formname.element.focus()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM