I take value from textbox as,

var perOfEasyQues = parseInt(document.getElementById("<%=txb_EasyQuesPerc.ClientID%>").value);

but as I put 012 it takes 10.

Can anybody suggest solution over it?

Since you are entering value with a preceding 0, the parseInt(<value>) function takes it as an octal number. Use the parseInt(<value>, <radix>) function instead with radix set to 10 for decimal numbers as shown below,

var perOfEasyQues = parseInt(document.getElementById("<%=txb_EasyQuesPerc.ClientID%>").value, 10);

Since you are entering value with a preceding 0, the parseInt(<value>) function takes it as an octal number. Use the parseInt(<value>, <radix>) function instead with radix set to 10 for decimal numbers as shown below,

var perOfEasyQues = parseInt(document.getElementById("<%=txb_EasyQuesPerc.ClientID%>").value, 10);

Thanks parry_kulk for your quick reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.