我有以下文字要求用户根据系统情况确认点击纽顿。
该系统的设置存放在从代码背后的暗中。
标记:
<asp:HiddenField ID="hfConfirmOnApproval" runat="server" Value="False" />
c) :
//Read the confirm on approval setting
hfConfirmOnApproval.Value = Objects.Engine.Settings.Instance.ConfirmOnApproval.ToString();
j)
//Get whether to confirm on approval
var _confirmOnApproval = new Boolean($( #hfConfirmOnApproval ).val());
if ( _confirmOnApproval ? confirm( Are you sure you want to approve this item? ) : true )
{
// do work
}
The problem is that the confirm message box is being displayed even though _confirmOnApproval is set to false?
我只想看到这个信息箱,如果它真的。
当时“ConfirmOnApproval”是假的。
SOLUTION:
j)
var _confirmOnApproval = $( #<%=hfConfirmOnApproval.ClientID %> ).val() == "True" ? true : false;
if ( _confirmOnApproval ? confirm( Are you sure you want to approve this item? ) : true ) {
//Do work
}