简体   繁体   English

location.reload(true)检查用户点击

[英]location.reload(true) Checking user click

I am calling location.reload(true) from javascript on button click it display the alert message , i want to hide the page when user click the button. 我从按钮上的javascript调用location.reload(true) ,它显示警告消息,我想在用户单击按钮时隐藏页面。 The page will appear again when page refresh is completed or user select cancel . 页面刷新完成或用户选择“取消”后,该页面将再次出现。

How to check user clicks on cancel/resend/continue? 如何检查用户单击取消/重新发送/继续?

Are you trying to get the user to answer a yes/no question? 您是否要让用户回答是/否问题? If so you need to use confirm() instead of alert() and check the return value. 如果是这样,则需要使用confirm()而不是alert()并检查返回值。 Yes/ok = true, no/cancel = false. 是/确定=真,否/取消=假。

I Think ultimately what you're trying to ask is how to check whether the user has clicked on you Cancel button. 我认为最终您要问的是如何检查用户是否单击了“取消”按钮。

If so, you must be new to jquery. 如果是这样,您必须是jquery新手。
you'd do this: 您可以这样做:

     <script>
       $(window).load(function(){
          location.reload(true);
       });

       $(document).ready(function(){
         $("#cancelButtonID").click(function(){
            //this code executes when your cancel button is clicked
             location.reload(true);
         });
       });
     </script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM