<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta forua="true" http-equiv="Cache-Control" content="max-age=0" /></head>
<card title="js Number类型 NaN和Infinity UEditor上传图片进度条有可能显示Infinity的问题" id="card1">
<p> 游客</p><p>
标题:js Number类型 NaN和Infinity UEditor上传图片进度条有可能显示Infinity的问题<br/>
正文:<br/>
js在计算数值时有2个值比较特殊，分别是：NaN 和 Infinity (-Infinity)Parsing something that isn't a number results in NaN. isNaN helps to detect those cases:parseInt(&quot;hello&quot;, 10) // NaN<br/>isNaN(parseInt(&quot;hello&quot;, 10)) // trueDivision through zero results in Infinity:1 / 0 // InfinityBoth NaN and Infinity are of type &quot;number&quot;:typeof NaN // &quot;number&quot;<br/> typeof Infinity // &quot;number&quot;Note that NaN compares in a strange way:NaN == NaN // false (!)But:Infinity == Infinity // true<br/>在UEditor里有个问题，上传图片（大图）的时候，进度条的百分比数比如：30%..90%..100%。有可能会变成：Infinity 。<br/>如图： 对应的文件地址：http://camnpr.com/ueditor/dialogs/image/image.js Line 551  修改一行代码，如下：percent = total ? loaded / total : 0;<br/>spans.eq(0).text(Math.round((percent == Infinity ? 1 : percent) * 100) + '%');// 修改此行<br/>spans.eq(1).css('width', Math.round(percent * 100) + '%');<br/><br/><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1458&amp;Page=1">[&lt;&lt;]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1458&amp;Page=1">[[1]]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1458&amp;Page=1">[&gt;&gt;]</a><br/>
<br/>
<a href="wap.asp?act=Com&amp;id=1458">查看评论(0)</a><br/>
<a href="wap.asp?act=AddCom&amp;inpId=1458">发表评论</a><br/><br/>

<br/>

<br/>
<a href="http://camnpr.com/wap.asp">首页</a>
</p>
</card>
</wml>