ASP / Javascript onClientClick SecurityCheck()

时间:2011-09-16 10:27:48

标签: javascript asp.net hyperlink onclientclick

在确认链接到另一个aspx文件之后,嘿想要javascript,但不知何故它不会将浏览器指向网址。这是我得到的

<asp:ImageButton ID="Donebtn" runat="server" ImageUrl="~/images/done.jpg" ToolTip="Done. Add new activity" CommandName="Done" CommandArgument='<%#Eval("ActivityID") %>' OnClientClick="return SecurityCheck();" /> 

的javascript

function SecurityCheck() 
  {

      return window("Mark Activity as completed and add new Activity?");
      if (o == true) 
      {
          window.location.href = 'CustomerHome.aspx?CustomerId=<%#Eval("CustomerID")%>';

      }
      else 
      {
          return window("No changes will be made");
      }
  }    

1 个答案:

答案 0 :(得分:0)

什么是o对象?您需要使用以下内容:

function SecurityCheck() 
{
  var answer = confirm("Mark Activity as completed and add new Activity?");
  if (answer) 
  {
      window.location.href = 'CustomerHome.aspx?CustomerId=<%#Eval("CustomerID")%>';
  }
  else 
  {
      alert("No changes will be made");
      return false;
  }
} 

<强> Live