2011-09-16 29 views
0

嘿希望javascript已经被确认后连接到另一个aspx文件,但不知何故它不会将浏览器导向到url。这里是我得到ASP/Javascript onClientClick安全检查()

<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"); 
     } 
    }  

回答

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

+0

感谢,但它仍然犯规重定向到的链接。我想它不理解链接的格式? – gsharpp

+0

实际上,我只是用http://www.google.com取代了该链接,并且它不会将其直接发送到那里。 hmm – gsharpp

+0

试试'window.location =“http://www.google.com/”;' – Samich