I n an aspx page I am using a javascript function like
function ReverseResult() {
document.getElementById("ctl00_ContentPlaceHolder1_txtIncrementAmount").value = parseInt(document.getElementById("ctl00_ContentPlaceHolder1_txtNewCTC").value) - parseInt(document.getElementById('<%=lblCurrentCTC.ClientID %>').innerText);
var result;
result = parseInt(document.getElementById("ctl00_ContentPlaceHolder1_txtIncrementAmount").value)*100 / parseInt(document.getElementById('<%=lblCurrentCTC.ClientID %>').innerText);
if(result == "Infinity")
{
document.getElementById("ctl00_ContentPlaceHolder1_txtIncrementPerc").value = 100.00;
}
else
{
document.getElementById("ctl00_ContentPlaceHolder1_txtIncrementPerc").value = result.toFixed(2);
}
}
This works fine in IE. But in the mozilla the result display as Nan
Pls help to solve this issue
Change innerText
to innerHTML
From the docs :
Mozilla also supports Internet Explorer's innerHTML method, which it can call on almost any node. It does not, however, support outerHTML (which adds markup around an element, and has no standard equivalent) and innerText (which sets the text value of the node, and which you can achieve in Mozilla by using textContent).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.