跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
MediaWiki帮助
根类
所有页面
统计信息
分类树
特殊页面
FC
搜索
搜索
外观
登录
个人工具
登录
查看“︁文件大小换算”︁的源代码
页面
讨论
简体中文
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
常规
链入页面
相关更改
页面信息
外观
移至侧栏
隐藏
←
文件大小换算
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
<html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> .file-size-converter { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; text-align: center; margin: 20px; } .file-size-converter h2 { color: #333; } .file-size-converter .form-group { display: flex; align-items: center; justify-content: center; margin: 15px 0; } .file-size-converter label { width: 100px; margin-right: 10px; text-align: right; } .file-size-converter input { width: 120px; padding: 8px; text-align: center; } </style> </head> <body> <div class="file-size-converter"> <h2>文件大小单位换算器</h2> <div class="form-group"> <label>Bit:</label> <input type="number" id="bit" oninput="convertFileSize(this.value, 'bit')"> </div> <div class="form-group"> <label>Bytes:</label> <input type="number" id="bytes" oninput="convertFileSize(this.value, 'bytes')"> </div> <div class="form-group"> <label>Kilobytes (KB):</label> <input type="number" id="kb" oninput="convertFileSize(this.value, 'kb')"> </div> <div class="form-group"> <label>Megabytes (MB):</label> <input type="number" id="mb" oninput="convertFileSize(this.value, 'mb')"> </div> <div class="form-group"> <label>Gigabytes (GB):</label> <input type="number" id="gb" oninput="convertFileSize(this.value, 'gb')"> </div> <div class="form-group"> <label>Terabytes (TB):</label> <input type="number" id="tb" oninput="convertFileSize(this.value, 'tb')"> </div> </div> <script> function convertFileSize(value, unit) { const bit = document.getElementById('bit'); const bytes = document.getElementById('bytes'); const kb = document.getElementById('kb'); const mb = document.getElementById('mb'); const gb = document.getElementById('gb'); const tb = document.getElementById('tb'); value = parseFloat(value); switch (unit) { case 'bit': bytes.value = value / 8; kb.value = value / 8 / 1024; mb.value = value / 8 / 1024 / 1024; gb.value = value / 8 / 1024 / 1024 / 1024; tb.value = value / 8 / 1024 / 1024 / 1024 / 1024; break; case 'bytes': bit.value = value * 8; kb.value = value / 1024; mb.value = value / 1024 / 1024; gb.value = value / 1024 / 1024 / 1024; tb.value = value / 1024 / 1024 / 1024 / 1024; break; case 'kb': bit.value = value * 8 * 1024; bytes.value = value * 1024; mb.value = value / 1024; gb.value = value / 1024 / 1024; tb.value = value / 1024 / 1024 / 1024; break; case 'mb': bit.value = value * 8 * 1024 * 1024; bytes.value = value * 1024 * 1024; kb.value = value * 1024; gb.value = value / 1024; tb.value = value / 1024 / 1024; break; case 'gb': bit.value = value * 8 * 1024 * 1024 * 1024; bytes.value = value * 1024 * 1024 * 1024; kb.value = value * 1024 * 1024; mb.value = value * 1024; tb.value = value / 1024; break; case 'tb': bit.value = value * 8 * 1024 * 1024 * 1024 * 1024; bytes.value = value * 1024 * 1024 * 1024 * 1024; kb.value = value * 1024 * 1024 * 1024; mb.value = value * 1024 * 1024; gb.value = value * 1024; break; default: break; } } </script> </body> </html> [[分类:在线工具集]]
返回
文件大小换算
。
搜索
搜索
查看“︁文件大小换算”︁的源代码
添加话题