我知道你不能拥有一个msgbox并且已经开始使用在Onclick 活动中使用Javascript的解决方案。 代码: DeleteBtn.Attributes.Add(" onClick"," javascript :return 确认(''你真的想要?'');") 选项,问题是如何获得返回值? 似乎无法在任何地方找到答案! 谢谢 AllHave searched the fields and hills for a good example butalass not a sausage have I found, well not quite!I understand that you cannot have a msgbox and have comeup with the solution to use Javascript on the OnclickEvent.Code:DeleteBtn.Attributes.Add("onClick", "javascript:returnconfirm(''Do you really want to?'');")Now this is fine, works and gives me an OK and CANCELoption, problem is how do I get a return value?Cannot seem to find an answer to this anywhere!Thanks 解决方案 HiCall a javascript function in onclick event of button.Try this:DeleteBtn.Attributes.Add("onClick", "javascript:checkConfirm()")<script language=javascript>function checkConfirm(){var res = confirm(''Do you really want to?'');//user res}</script>Ravikanth[MVP] -----Original Message-----AllHave searched the fields and hills for a good examplebutalass not a sausage have I found, well not quite!I understand that you cannot have a msgbox and have comeup with the solution to use Javascript on the OnclickEvent.Code:DeleteBtn.Attributes.Add("onClick", "javascript:returnconfirm(''Do you really want to?'');")Now this is fine, works and gives me an OK and CANCELoption, problem is how do I get a return value?Cannot seem to find an answer to this anywhere!Thanks.HiCall a javascript function in onclick event of button.Try this:DeleteBtn.Attributes.Add("onClick", "javascript:checkConfirm()")<script language=javascript>function checkConfirm(){var res = confirm(''Do you really want to?'');//user res}</script>Ravikanth[MVP] -----Original Message-----AllHave searched the fields and hills for a good examplebutalass not a sausage have I found, well not quite!I understand that you cannot have a msgbox and have comeup with the solution to use Javascript on the OnclickEvent.Code:DeleteBtn.Attributes.Add("onClick", "javascript:returnconfirm(''Do you really want to?'');")Now this is fine, works and gives me an OK and CANCELoption, problem is how do I get a return value?Cannot seem to find an answer to this anywhere!Thanks.yop,Try this out:WebControlButton.Attributes.Add("onClick", "javascript:if(!confirm(''" &MessageToDisplay & "'')) return false;")Sincerely,--S. Justin Gengo, MCPWeb DeveloperFree code library at: www.aboutfortunate.com"Out of chaos comes order."Nietzche"yop" <yo*@oceanfree.net> wrote in messagenews:0a****************************@phx.gbl... All Have searched the fields and hills for a good example but alass not a sausage have I found, well not quite! I understand that you cannot have a msgbox and have come up with the solution to use Javascript on the Onclick Event. Code: DeleteBtn.Attributes.Add("onClick", "javascript:return confirm(''Do you really want to?'');") Now this is fine, works and gives me an OK and CANCEL option, problem is how do I get a return value? Cannot seem to find an answer to this anywhere! Thanks 这篇关于PopUp Message又名Msgbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-01 19:49