在提交和 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>

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...