如何解决在提交和 oclock 不一起工作
我已经阅读了以前的帖子,并尝试在 HTML 中的表单元素上应用 onsubmit,但似乎仍然不起作用。我有它如下:
<form class="button" id="arrow" onsubmit='return hotelList()'>
<input type='submit' value='Submit'/>
</form>
和js:
const hotelList = () => window.location.href = './ochome.html';
有什么建议吗?谢谢
完整代码: 新问题:我的必填字段似乎不起作用,并且无论如何都会将我发送到另一个页面......
enter code here
<form action="/user-details.html" class='login'>
<!-- is this GET or POST?? -->
<label for="username" >Username</label><br>
<input class="whitebox" type="text" id='username' required/>
<label for="pass" id='pass'>Password</label><br>
<input class="whitebox" type='password' id='passBox' required/>
<input type="submit" id='arrow' value="> Submit">
</form>
解决方法
表单包含您要提交的所有输入,操作类似于:action="/file.js" 并且它必须是一个处理数据的文件
代码:
<form action="/user-details.html">
<label for="fname">First name:</label><br>
<input class="whitebox" type="text" id='username' required/>
<label for="lname">Last name:</label><br>
<input class="whitebox" type='password' id='passBox' required/>
<input type="submit" value="Submit"/>
</form>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。