212206314 1 month ago
parent bd1029dec6
commit 1ea76fef40

3
.idea/.gitignore vendored

@ -0,0 +1,3 @@
# 默认忽略的文件
/shelf/
/workspace.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="openjdk-22" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Decimal-conversion.iml" filepath="$PROJECT_DIR$/.idea/Decimal-conversion.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -0,0 +1,3 @@
# 默认忽略的文件
/shelf/
/workspace.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="openjdk-22" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Decimal-conversion.iml" filepath="$PROJECT_DIR$/.idea/Decimal-conversion.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>基数转换器</title>
</head>
<body>
<h1>基数转换器</h1>
<form id="baseConverterForm">
<label for="sourceBase">源基数 (2-16):</label>
<input type="number" id="sourceBase" name="sourceBase" min="2" max="16" required>
<br><br>
<label for="valueToConvert">要转换的值:</label>
<input type="text" id="valueToConvert" name="valueToConvert" required>
<br><br>
<label for="targetBase">目标基数 (2-16):</label>
<input type="number" id="targetBase" name="targetBase" min="2" max="16" required>
<br><br>
<button type="submit">转换</button>
</form>
<div id="result"></div>
<!-- JavaScript代码将放在这里 -->
<script>
document.getElementById('baseConverterForm').addEventListener('submit', function(event) {
event.preventDefault(); // 阻止表单默认提交行为
const sourceBase = parseInt(document.getElementById('sourceBase').value);
const targetBase = parseInt(document.getElementById('targetBase').value);
const valueToConvert = document.getElementById('valueToConvert').value.toUpperCase();
// 转换逻辑
let decimalValue = parseInt(valueToConvert, sourceBase);
let convertedValue = decimalValue.toString(targetBase);
// 将结果展示在页面上
document.getElementById('result').innerHTML = `转换后的值: ${convertedValue}`;
});
</script>
</body>
</html>
Loading…
Cancel
Save