特定の入力ボックスにカーソルを自動的に配置するにはどうすればよいですか。これは、ページを開いているときに常にマウスを使用しないようにするのに役立ちます。(phpおよびhtml)
ありがとうございました!
<input name="input1" id="input1" value="" />
window.onload = init;
function init(){
document.getElementById("input1").focus();
}
これはする必要があります
window.onload = function(){
document.getElementById("InputBoxID").focus();
};
focus()の入力方法を使用しbody.onLoadます。
<input type="text" autofocus="autofocus" name="FirstName"/>
ページが読み込まれると、テキストフィールドがフォーカスされます。
詳細については、このオートフォーカス属性リンクを確認してください