Compare commits
No commits in common. 'master' and 'mmp' have entirely different histories.
@ -1,19 +0,0 @@
|
|||||||
<script>
|
|
||||||
function convert() {
|
|
||||||
const inputNumber = document.getElementById("inputNumber").value;
|
|
||||||
const fromBase = parseInt(document.getElementById("fromBase").value);
|
|
||||||
const toBase = parseInt(document.getElementById("toBase").value);
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 将输入的原进制数转换为10进制
|
|
||||||
const decimalValue = parseInt(inputNumber, fromBase);
|
|
||||||
// 将10进制数转换为目标进制
|
|
||||||
const convertedValue = decimalValue.toString(toBase).toUpperCase();
|
|
||||||
|
|
||||||
// 显示结果
|
|
||||||
document.getElementById("result").innerText = `转换结果 (Y): ${convertedValue}`;
|
|
||||||
} catch (error) {
|
|
||||||
document.getElementById("result").innerText = "转换失败,请确保输入正确。";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
Loading…
Reference in new issue