function convertNUM(beforeCountTest){ //轉換之前的科學計數法表示 var tempValue =beforeCountTest.value; var tempValueStr = new String(tempValue); if ((tempValueStr.indexOf("E") != -1) ||(tempValueStr.indexOf("e") !=-1)){ alert(tempValueStr + "是科學計數法表示!"); var regExp = new RegExp( "^((\\d+.?\\d+)[Ee]{1}(\\d+))$","ig" ); var result =regExp.exec(tempValue); var resultValue= ""; var power = ""; if (result != null){ resultValue = result[2]; power = result[3]; result =regExp.exec(tempValueStr); } if (resultValue != "" ){ if (power != "" ){ var powVer = Math.pow(10,power); alert( "10的" + power + "次方[" + powVer + "]"); resultValue = resultValue *powVer; } } $( "afterCountTest").value=resultValue; } }
function convertNUM(beforeCountTest){ //轉換之前的科學計數法表示 var tempValue =beforeCountTest.value; var tempValueStr = new String(tempValue); if ((tempValueStr.indexOf("E") != -1) ||(tempValueStr.indexOf("e") !=-1)){ alert(tempValueStr + "是科學計數法表示!"); var regExp = new RegExp( "^((\\d+.?\\d+)[Ee]{1}(\\d+))$","ig" ); var result =regExp.exec(tempValue); var resultValue= ""; var power = ""; if (result != null){ resultValue = result[2]; power = result[3]; result =regExp.exec(tempValueStr); } if (resultValue != "" ){ if (power != "" ){ var powVer = Math.pow(10,power); alert( "10的" + power + "次方[" + powVer + "]"); resultValue = resultValue *powVer; } } $( "afterCountTest").value=resultValue; } }