有没有办法从另一个页面触发jquery单击功能

有没有办法从另一个页面触发jquery单击功能,jquery,asp.net,Jquery,Asp.net,有没有办法在不同的页面中触发单击功能 第一页: <a>Create</a> <script> $('#createSp').click(function () { window.location.href = "../Admin/UserAdministration.aspx"; $('#btn_create_user').trigger('click'); }); </script> 创建 $('#createSp')。单击(函数()

有没有办法在不同的页面中触发单击功能

第一页:

<a>Create</a>

<script>
$('#createSp').click(function () {
window.location.href = "../Admin/UserAdministration.aspx";
$('#btn_create_user').trigger('click');
    });
</script>
创建
$('#createSp')。单击(函数(){
window.location.href=“../Admin/UserAdministration.aspx”;
$('btn'u create'u user')。触发器('click');
});
第二页:

<asp:HyperLink ClientIDMode="Static" ID="btn_create_user" CssClass="btn ci_btn btn-default" runat="server">Create User</asp:HyperLink>

<script>
$('#btn_create_user').click(function () {});
</script>
创建用户
$('#btn_create_user')。单击(函数(){});

不,您不能直接触发对其他页面的单击。在加载新页面之前,将重置并卸载当前DOM和其他所有内容。但是,您可以留下cookie或通过url将单击操作作为锚散列传递

<button id='createSp'>Create</button>

<script>
$('#createSp').click(function () {
      window.location.href = "../Admin/UserAdministration.aspx#create";
});
</script>
$( document ).ready(function() {
  var hash = window.location.hash.substring(1); //get the string after the hash
  if(hash =='create'){
      $('#btn_create_user').trigger('click');
  }
});