Javascript 为什么任何html按钮都会导致aspx页面中的回发?
我已经在SharePoint网站上创建了.aspx页面,并插入到页面HTML按钮中 示例Javascript 为什么任何html按钮都会导致aspx页面中的回发?,javascript,html,asp.net,sharepoint,Javascript,Html,Asp.net,Sharepoint,我已经在SharePoint网站上创建了.aspx页面,并插入到页面HTML按钮中 示例 <PublishingWebControls:editmodepanel PageDisplayMode="Display" runat="server" SuppressTag="True"> ... <button>Click Me!</button> ... </PublishingWebControls:editmodepanel> ...
<PublishingWebControls:editmodepanel PageDisplayMode="Display" runat="server" SuppressTag="True">
...
<button>Click Me!</button>
...
</PublishingWebControls:editmodepanel>
...
点击我!
...
每次我点击“点击我!”回发发生。这不是我想要的行为,但我已经找到了一种方法,可以避免引起回帖。我将javascript代码添加到onclick属性单击我代码>
我的问题是,即使按钮不包含type=“submit”
属性,为什么会发生回发
我还检查了母版页,其中包含
并包装了所有内容,并且没有action=“page.aspx”
属性。检查此链接,
页面上有一条说明,不同的浏览器可以为按钮使用不同的默认类型,如果您不自己指定的话。似乎你的浏览器使用了“提交”。我知道这是一篇老文章@Dmytro的帖子引导了正确的方向,但不是确切的答案。要防止回发,需要使用按钮标记的type属性。i、 e
点击我代码>每个浏览器对按钮标签的解释都不同。您可以使用
,它也不应该导致回发。@Jmoreland91您应该将此作为答案编写。我会投赞成票的。我已经调试我的应用程序好几个小时了,这神奇地修复了一切!你救了我的好朋友!