C# javascript代码在Internet Explorer中运行良好,但在Firefox和Google chrome中不起作用

C# javascript代码在Internet Explorer中运行良好,但在Firefox和Google chrome中不起作用,c#,javascript,jquery,asp.net,C#,Javascript,Jquery,Asp.net,下面的javascript代码在Internet Explorer中运行良好,但在Firefox和Google chrome中不起作用 var prand=11211411110311410111511510511111068508491; //This is the value of variable prand that i get after calculation prand = parseInt(prand.substring(0, 10)) + parseInt(prand.s

下面的javascript代码在Internet Explorer中运行良好,但在Firefox和Google chrome中不起作用

var prand=11211411110311410111511510511111068508491;
//This is the value of variable prand that i get after calculation 
prand =   parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString(); 
//After this calculation I'm getting the expected  result in IE,but the value is coming different in Firefox and Chrome
我已经整理了更多的信息

在发出警报时,会显示
parseInt(prand.substring(10,prand.length))

IE上的
2323320214657586650000
和Chrome上的
3.114101115105E+29
如果要使用子字符串,请确保原始变量是字符串。Chrome发现您的prand变量没有引号,因此它尝试将其转换为最大的数字。另一方面,IE放弃并将其用作字符串。尝试将变量声明为字符串:

var prand=11211411110311410111511510511111068508491;
//This is the value of variable prand that i get after calculation 
prand =   parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString(); 
//After this calculation I'm getting the expected  result in IE,but the value is coming different in Firefox and Chrome
var prand = "11211411110311410111511510511111068508491";

即使如此,31141011510511111068508491的值也太大,无法放入单个整数中。您可能需要重新考虑您的逻辑。

。您的号码太大。请在发布之前尝试运行您的代码。它有太多的问题。我已经运行了代码。如果没有这些,我就无法告诉IE和Chrome上的值Saboc先生,实际上,经过一组计算后,我将值11211411110311410111510511111068508491转换为变量prand。因此,无法将其转换为string。这在IE8中仍然是一个数字。你用哪个IE测试它?