开发者

How to call onclick event on confirm message alert box?

I am using a javascript

function ValueChanged()
{           
    if (document.getElementById("<%=isDirty.ClientID %>").value != document.getElementById("<%=rdbQuestiontype.ClientID %>").value)     
    {

       if (window.confirm('Your changes are not saved. Do you want 开发者_JAVA技巧to save your changes before you exit.'))
           return false;
       else
           return true;
    }
}

this java script i am calling on OnClientClick="return ValueChanged();

I have a Save button on the same page i want to save the data when client click on OK button of cinfirm alert OK btn. Means my onclick="btnsave_Click" event also call and my data get save on confirm message OK btn.


<asp:Button runat="server" ID="btnOK" Text="OK" OnClientClick="Javascript:return confirm('Your Message')" OnClick="btnOK_Click" />


I have change something in javascript

if (document.getElementById("<%=isDirty.ClientID %>").value != document.getElementById("<%=txbText.ClientID %>").value) 
{ 
  var ssave = window.confirm('Your changes are not saved. Do you want to save your changes before you exit.') 
if (ssave == true) 
{ 
  document.getElementById('<%=btnSave.ClientID%>').click(); 
  return false; 
} 
  else return true; 
} 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜