我有一个ASP按钮,单击该按钮会弹出一个window.confirm
。这window.confirm
消失而无需用户交互。但是,如果我一直单击ASP按钮,则在大约第四或第五次单击后,该window.confirm
框将按预期工作。
经过数小时的工作后,我还注意到了几件事,如果我Text
从ASP按钮中删除该属性,则window.confirm
可以正常工作。
This made me think, "Hmmmm... let me look at the <input>
button that is behind the scenes of the ASP button, and I noticed that if I remove the value from the input the window.confirm
works, but if I put a value in the input, the window.confirm stops working again.
Does anyone know what may cause this? Is there a work around to putting text in the button without using the Text property? I haven't tried innerHTML yet because I wanted to see if there is anything else I can do before I do that.
Btw, I tried using OnClientClick
, instead of OnClick
and I get the same results.
Here is the code that I have for the button:
<asp:Button ID="btSubmit" runat="server" Text ="Submit Email" OnClick="btSubmit_Click" OnClientClick="return confirm('Test');"/>
我刚刚遇到了同样的问题。在调查问题时,我发现代码本身是可以的,但是将其放在网站的上下文中后,如上所述就开始失败。问题似乎是通过GTM调用的Facebook跟踪代码。如果我从标题中删除了整个Google跟踪代码管理器代码,则一切正常
尽管这还不是解决方案,但是我需要进行更深入的GTM调查,以防止此行为。但这也可以帮助您...
这听起来像是一个线索,因为我确实在页面底部注意到了有关“等待加载Facebook .. yadayada”的信息。让我看看
您是否碰巧删除了实际的代码行?
是的!好的Google Analytics(分析)。我仔细阅读了所有涉及Google Analytics(分析)的代码,并对其进行了注释。就像您说的,这不是最终的解决方案,但是很高兴知道这与我们的直接代码无关。我将接受您的回答,并查看是否可以找到解决此问题的方法。谢谢!!!
@DJBurb在哪里可以找到不涉及删除GA / GTM的解决方案?
@DJBurb检查其他使用chrome的可用计算机是否已启用任何广告拦截功能。在我的电脑上对我自己来说:1)启用广告拦截功能后,由于fbevents和其他通过GTM的脚本被封锁,confirm()和alert()可以100%工作。2)禁用adblock(ublock)的同一个Chrome浏览器,然后确认并使用alert()不起作用。在我们的情况下,我们无法删除GTM,因此对于内部人员,我们已启用了广告拦截功能。寻找必须使用GTM的门户网站外部客户的解决方案。