我有一个弹出窗口中的表单,我已经设置了 autofocus 属性autofocus="autofocus"
,但是当表单加载时它没有聚焦但是如果你刷新页面它会聚焦。表单被插入到div
.
表格样本:
First Name:<input type="text" name="fname" placeholder="First Name" class="userField" autofocus="autofocus" id="firstNameUserField" value="<?php
if(isset($_SESSION['firstname'])){
echo trim($_SESSION['firstname']);
}
?>">
div表单插入:
<div class="main">
<a href="#x" class="overlay" id="detail_form"></a>
<div class="popup">
<div id="detailFormPopup"></div>
<a class="close" id="logClose"href="#close"></a>
</div>
</div>
如果用户登录并单击其用户名,则会显示表单:
if(isset($_SESSION['username'])){
echo "<a href='#detail_form' class='navlinks' id='navUser'>".$_SESSION['username']."</a></h3>";
}