gpt4 book ai didi

javascript - 为什么即使我将类型设置为按钮(而不是提交),按钮也会提交表单?

转载 作者:行者123 更新时间:2023-12-02 19:48:30 25 4
gpt4 key购买 nike

点击“添加另一个开始和结束时间”。请注意“删除此段”。按钮的行为就好像它们的类型没有改变一样。我通过 JSLint 运行了这个,没有任何问题,并且在控制台中没有收到错误。使用 Chrome 中的网络开发人员工具,它的 type 属性似乎没有设置。我不明白发生了什么事。

http://jsfiddle.net/gtr053/xtGPR/

最佳答案

火狐说:

Error: uncaught exception: [Exception... "Index or size is negative or greater than the allowed amount" code: "1" nsresult: "0x80530001 (NS_ERROR_DOM_INDEX_SIZE_ERR)" location: "http://fiddle.jshell.net/gtr053/xtGPR/show/ Line: 39"]

第 39 行是:

document.getElementById('start_end_times').getElementsByTagName('tbody')[0].deleteRow(index);

所以大概索引是错误的。

关于javascript - 为什么即使我将类型设置为按钮(而不是提交),按钮也会提交表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9595148/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com