去除 indexOf 校验逻辑;部分字符串解义
This commit is contained in:
parent
bfc500385f
commit
61c643ba44
@ -960,7 +960,7 @@ var yelem = document.getElementById("y");
|
|||||||
var calgroup = document.getElementById("calgroup");
|
var calgroup = document.getElementById("calgroup");
|
||||||
var cal1elem = document.getElementById("cal1");
|
var cal1elem = document.getElementById("cal1");
|
||||||
var cal2elem = document.getElementById("cal2");
|
var cal2elem = document.getElementById("cal2");
|
||||||
window.addEventListener("DOMContentLoaded", function() {
|
window.addEventListener("DOMContentLoaded", function () {
|
||||||
calgroup.style.display = "none";
|
calgroup.style.display = "none";
|
||||||
var params = GetURLParams();
|
var params = GetURLParams();
|
||||||
if (Object.keys(params).length > 0 && params.d != "") {
|
if (Object.keys(params).length > 0 && params.d != "") {
|
||||||
@ -979,9 +979,7 @@ function GetURLParams() {
|
|||||||
while (match = regex.exec(url)) {
|
while (match = regex.exec(url)) {
|
||||||
params[match[1]] = match[2]
|
params[match[1]] = match[2]
|
||||||
}
|
}
|
||||||
if (url.indexOf('8jz') > -1) {
|
return params
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function swap() {
|
function swap() {
|
||||||
@ -1012,7 +1010,7 @@ function base2decimal(x, dec, b) {
|
|||||||
d = parseInt(x[i], b);
|
d = parseInt(x[i], b);
|
||||||
e = idot - i - 1;
|
e = idot - i - 1;
|
||||||
e = e.toString();
|
e = e.toString();
|
||||||
txt += "(" + d + " \u00D7 " + b + "<sup>" + e + "</sup>)";
|
txt += "(" + d + " × " + b + "<sup>" + e + "</sup>)";
|
||||||
if (i < len - 1) txt += " + "
|
if (i < len - 1) txt += " + "
|
||||||
}
|
}
|
||||||
if (minus) txt += "]";
|
if (minus) txt += "]";
|
||||||
@ -1036,7 +1034,7 @@ function decimal2base(dec, y, b) {
|
|||||||
var nd = y.length - y.indexOf(".") - 1;
|
var nd = y.length - y.indexOf(".") - 1;
|
||||||
if (nd > 6) nd = 6;
|
if (nd > 6) nd = 6;
|
||||||
if (id >= 0 && nd > 0) {
|
if (id >= 0 && nd > 0) {
|
||||||
txt = "\u5c06\u76ee\u6807\u57fa\u6570\u4e58\u4ee5\u7ed3\u679c\u7684\u5c0f\u6570\u4f4d\u6570\u0028\u6700\u9ad8\u53ef\u8fbe\u0036\u4f4d\u6570\u0029\u003a<br>";
|
txt = "将目标基数乘以结果的小数位数(最高可达6位数):<br>";
|
||||||
txt += "floor(" + dec + "×" + b + "<sup>" + nd + "</sup>) = ";
|
txt += "floor(" + dec + "×" + b + "<sup>" + nd + "</sup>) = ";
|
||||||
dec = Math.floor(dec * Math.pow(b, nd));
|
dec = Math.floor(dec * Math.pow(b, nd));
|
||||||
txt += dec
|
txt += dec
|
||||||
@ -1073,8 +1071,8 @@ function onconvert() {
|
|||||||
y = y.toString(b2).toUpperCase();
|
y = y.toString(b2).toUpperCase();
|
||||||
yelem.value = y;
|
yelem.value = y;
|
||||||
var yd = yelem.value.match(/[\dA-Z]/g);
|
var yd = yelem.value.match(/[\dA-Z]/g);
|
||||||
var ylabel = "\u8f6c\u6362\u7ed3\u679c\uff1a";
|
var ylabel = "转换结果:";
|
||||||
if (yd != null) ylabel += " (" + yd.length + ((yd.length == 1) ? " \u4f4d)" : " \u4f4d)");
|
if (yd != null) ylabel += " (" + yd.length + " 位)";
|
||||||
document.getElementById("ylabel").innerHTML = ylabel;
|
document.getElementById("ylabel").innerHTML = ylabel;
|
||||||
document.getElementById("b1txt").innerHTML = b1;
|
document.getElementById("b1txt").innerHTML = b1;
|
||||||
document.getElementById("b2txt").innerHTML = b2;
|
document.getElementById("b2txt").innerHTML = b2;
|
||||||
|
Loading…
Reference in New Issue
Block a user