English 中文(简体)
任何人都看不出这种 j子或 j子有什么错误?
原标题:can anyone see anything wrong with this js / jQuery?

我有以下文字要求用户根据系统情况确认点击纽顿。

该系统的设置存放在从代码背后的暗中。

标记:

<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
}
最佳回答

这是因为您在使用<条码>新布莱曼制造了一种诱杀装置,而<条码>则将退回“目标”:

var x = new Boolean(false); //Boolean object
if(x) {
   console.log("hello"); //This will always execute
}
var y = false; //Literal boolean primitive
if(y) {
   console.log("hello"); //This won t
}

You could get rid of new Boolean and just compare the value:

if(_confirmOnApproval == "False")
问题回答

除詹姆斯的答复外,你还必须修改现行法典,以明确检查象牙齿一样的毛豆状况。

var _confirmOnApproval = new Boolean($( #hfConfirmOnApproval ).val());
if ( _confirmOnApproval === true ? confirm( Are you sure you want to approve this item? ) : true ) 
{
    // do work
}

我认为,问题在于,它始终具有价值......试图占用这一价值的时间,这或许会奏效。

http://www.un.org/Depts/DGACM/index_french.htm

为此:

var _confirmOnApproval = $( input[type=hidden][id$=hfConfirmOnApproval] ).val();

if ( _confirmOnApproval === "False" ? confirm( Are you sure you want to approve this item? ) : true ) 
{

    // do work

}




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签