2013-01-11 115 views
1
<span id="9460116557269599" onclick="getdata(6557269599,9460116557269599)"> More...</span> 

function getdata(tn,x){ 
alert(x); 
} 

为什么将9460116557269600作为x收到。为什么JavaScript增加我的号码?

应该9460116557269599.

+2

这里没有jquery。 –

+0

两种不同的功能:getdata vs geth20 – Blazemonger

+0

这可能与数字的长度有关?你使用的是什么操作系统和浏览器? – ManseUK

回答

5

JavaScript中的所有数字都是浮点数,而9460116557269599.0 == 9460116557269600.0。

+0

不错的工作!非常感谢! – Pinch

0

geth20应该getdata

jsBin demo

function getdata(tn,x){ 
    alert(x); // 9460116557269599 
} 
2

要调用函数getdata,而功能的代码,你已经证明我们是为geth20,这么清楚代码在功能getdata中被更改。

编辑:现在你已经编辑了代码,Anton Kovalenko的回答绝对正确。

+0

对不起,我编辑我的问题到正确的代码 – Pinch

+1

+1为诚实和努力! - 谢谢! – Pinch

相关问题