📄 web21.html
字号:
<html>
<head>
<title>the page is very good</title>
<script language="JavaScript">
function a()
{
var a=document.form1.text1.value;
a=a*1;
var b=document.form1.text2.value;
b=b*1;
var c;
if(b<10)
{c=b.toPrecision(a+1);}
else if(b>=10)
{c=b.toPrecision(a+2);}
else if(b>=100)
{c=b.toPrecision(a+3);}
else if(b>=1000)
{c=b.toPrecision(a+4);}
else if(b>=10000)
{c=b.toPrecision(a+5);}
else if(b>=100000)
{c=b.toPrecision(a+6);}
document.form1.text3.value=c;
}
</script>
<body>
<form name="form1">
please enter the decimal :
<input type="text" name="text1"><br>
please the number:
<input type="text" name="text2"><br>
result:
<input type="text" name="text3"><br>
<input type="button" onclick="a()">
</form>
<body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -