html - 我如何制作它,以便我可以浏览整个表格?
问题描述
我正在为网站创建一个表单,但现在它只允许我从手机向下切换。我无法从名字到姓氏再到电话。如何更改它以允许我浏览整个内容?
<form data-customer-information-form="true" autocomplete="off" method="POST" action="addticket/submit" name="ticketForm" id="ticketform" accept-charset="UTF-8">
<p>
<label for="customerFirstName">First Name:</label></br>
<input type="text" name="customerFirstName" id="customerFirstName" placeholder="first name" pattern="[A-Za-z]+" required>
</p>
<p>
<label for="customerLastName">Last Name:</label></br>
<input type="text" name="customerLastName" id="customerLastName" placeholder="last name" required>
</p>
<p>
<label for="phoneNumber">Phone: used for contact</label></br>
<input type="tel" id="phone" maxlength="12" name="phoneNumber" placeholder="phone" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" required>
</p>
<p>
<label for="email">Email:</label></br>
<input type="email" name="email" id="email" placeholder="email">
</p>
<p>
<label for="service">Computer/Service Name:</label></br>
<input type="text" name="service" placeholder="computer model or service" required>
</p>
<p>
<label for="description">Anything else we need to know:</label></br>
<textarea type="text" maxlength="200" name="description" id="description" placeholder="What's gone wrong?"></textarea>
</p>
<input type="submit" name="submit" value="Submit" id="submit">
</form>
当我将 HTML 复制到 HTML 查看器中时,它工作正常。但在页面的其余部分它停止工作。
解决方案
确保您的 javascript 没有阻止某些键。
document.getElementById("customerFirstName").onkeydown = function(e){
if(!(e.keyCode === 8 || e.keyCode ===46 || keypress.keyCode === 9)){
if(!(/[A-Za-z]/i.test(String.fromCharCode(e.keyCode)))) {
e.preventDefault();
return false;
}
}
}
推荐阅读
- excel - 选择一个文件并复制到 Excel VBA 中的文件夹
- python - 无法在 Windows 上使用 pipenv 创建环境
- javascript - React - Rxjs:在流中转换父组件事件处理程序
- javascript - div上的悬停问题,水平滚动出现在最后一个div上
- google-apps-script - 谷歌 adon 中的清单文件
- flutter - 在按钮上的文本字段小部件中显示输出 在 Flutter 中单击按钮计算后单击按钮
- java - 如何自定义请求正文的示例值并使用 springdoc-open-api 在 swagger-ui 上执行它
- jquery - 如何在一个`.on` jQuery代码中使用两个事件
- go - 如何模拟 amqp.Dial 等库中的函数
- javascript - 如何在对象中迭代地添加键:值