为了账号安全,请及时绑定邮箱和手机立即绑定

button按钮没有onclick事件,点击按钮执行操作

button按钮没有onclick事件,点击按钮执行操作

慕瓜2019 2019-05-05 18:07:27
单位的网站有个查询功能,使用的是button按钮,但是没有onclick事件,可是点击按钮后,还是去执行了代码我的问题:1、js是嵌入到html页面的,那个js文件里好多的东西,不知道哪个是这个按钮点击后执行的代码,我应该如何找到它呢?2、如果没有onclick事件,是怎么实现点击按钮执行的呢?不知道我这样说是不是能够部清楚,请知道的朋友帮忙解答下,谢谢
查看完整描述

1 回答

已采纳
?
业余奶茶品鉴师

TA贡献260条经验 获得超388个赞

在button的type设置为submit的时候,就像这样

<button type="submit">button</button>

不用onclick,就可以直接提交form表单

查看完整回答
2 反对 回复 2019-05-06
  • 慕瓜2019
    慕瓜2019
    谢谢您的解答,那如何找到执行的哪个JS代码呢?
  • 业余奶茶品鉴师
    业余奶茶品鉴师
    你全局搜索一下button的id,看看有没有绑定什么方法,还有form上有没有绑定方法。望采纳
  • 慕瓜2019
    慕瓜2019
    <form id="my-form" class="aaaeee" > <section name="信息查询 1"> <div id="languages"> <div style="display:flex; justify-content:center; align-items:center; width:100%; "> <input id="username" placeholder="请输入需要查询的信息" style="margin-right:20px;margin-top:10px;" name="username" type="text"/> <button type="submit" style="margin-top:10px;" onclick="tracking()">立即查询</button> </div> </div> </section> <section name="信息查询 2"> <div id="languages"> <div style="display:flex; justify-content:center; align-items:center; width:100%; "> <div style="margin-right:12%"> <select onchange="window.location=this.value;" > <option value ="">查询内容I</option> <option value ="seach_1.asp">查询内容2</option> <option value ="seach_2.asp">查询内容3</option> </select> </div> <div style="margin-right:8%" > <select onchange="window.location=this.value;" > <option value ="">查询内容II</option> <option value ="seach_3.asp">查询内容4</option> <option value ="seach_4.asp">查询内容5</option> </select> </div> </div> </div> </section> <div><hr/></div> </form>
点击展开后面4
  • 1 回答
  • 0 关注
  • 4697 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信