温度换算js脚本代码分享

2周前 (05-09 17:11)阅读12回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值4784
  • 级别管理员
  • 主题956
  • 回复2
楼主

温度换算js脚本代码,用户输入数字后点击按钮即可换算成多种格式的摄氏度,这是很实用的换算网页特效代码。

<html>
<head>
<meta http-equiv="content-Type" content="text/html;charset=gb2312">
<meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren">
<meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。">
<title>温度换算js脚本代码分享_武鸣人</title>
<SCRIPT language=JScript>
<!--
var k=273.15;
var ct=0;
var temp=0;
var choice=0;
var cap1=new Array(6);
cap1[0]="摄氏度";
cap1[1]="华氏度";
cap1[2]="开氏度";
cap1[3]="兰氏度";
cap1[4]="列氏度";
cap1[5]="摄氏度";
var cap2=new Array(10);
cap2[0]="华氏度"
cap2[1]="开氏度"
cap2[2]="兰氏度"
cap2[3]="列氏度"
cap2[4]="摄氏度"
cap2[5]="华氏度"
cap2[6]="开氏度"
cap2[7]="兰氏度"
cap2[8]="列氏度"
cap2[9]="摄氏度"
<!-- TEMPERATURE ARRAY-->
var t=new Array(12);
t[0]=0;
t[1]=0;
t[2]=0;
t[3]=0;
t[4]=0;
t[5]=0;
t[6]=0;
t[7]=0;
t[8]=0;
t[9]=0;
t[10]=0;
t[11]=0;
function calc(boxes)
{//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
document.boxes.b1a.value=(cap1[choice]);
document.boxes.b2a.value=(cap2[choice]);
document.boxes.b3a.value=(cap2[choice+1]);
document.boxes.b4a.value=(cap2[choice+2]);
document.boxes.b5a.value=(cap2[choice+3]);
<!-- Converting input number to Kelvin-->
temp=eval(document.inbox.b0.value);
document.boxes.b1.value=temp;
if (choice==0){temp=temp + k};
if (choice==1){temp=((temp-32)/1.8)+273.15};
if (choice==2){temp=temp*1};
if (choice==3){temp=temp/1.8};
if (choice==4){temp=(temp*1.25)+273.15};
if (choice==5){};
if (choice==0){ct=1}
if (choice==1){ct=2}
if (choice==2){ct=3}
if (choice==3){ct=4}
if (choice==4){ct=5}
if (choice==5){ct=6}
t[0]=(temp-273.15);
t[1]=(temp-273.15)*1.8 + 32;
t[2]=(temp);
t[3]=temp*1.8;
t[4]=(temp-273.15)/1.25;
t[5]=temp-273.15;
t[6]=(temp-273.15)*1.8 + 32;
t[7]=(temp);
t[8]=(temp*1.8);
t[9]=(temp-273.15)/1.25;
t[10]=(temp-273.15);
t[11]=(temp-273.15)*1.8 + 32;
document.boxes.b2.value=t[ct];ct=ct+1;
document.boxes.b3.value=t[ct];ct=ct+1;
document.boxes.b4.value=t[ct];ct=ct+1;
document.boxes.b5.value=t[ct];ct=ct+1;
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
//-->
</SCRIPT>
</head>
<body>
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
<TABLE width="100%" border="0" cellPadding=0 cellSpacing=0 class="small">
                    <TBODY>
                    <TR>
                      <TD valign="top"><br>
                        <table width="75%"  border="0" align="center" cellpadding="0" cellspacing="0" class="small">
                          <tr>
                            <td>   可实现摄氏度(CELSIUS EQUALS)、华氏度(FARENHEIT EQUALS)、开氏度(KELVIN EQUALS)、兰氏度(RANKINE EQUALS)、列氏度(REAUMUR EQUALS)五种温度计量单位间的互转互换。</td>
                          </tr>
                        </table>
                        <br>
                        <table width="75%"  border="0" align="center" cellpadding="0" cellspacing="0" class="small">
                          <tr>
                            <td>
<strong>要转换的温度值:</strong>
                            </td>
                          </tr>
                          <tr>
                            <td>
<FORM name=inbox>
                          <INPUT
                        name=b0 type=number class="SmallInput" size=6>  类型: <INPUT onclick="choice=0; calc(); return true" type=button size=5 value=摄氏度 class='SmallButton'  name=button>
<INPUT onclick="choice=1; calc(); return true" type=button size=5 value=华氏度 class='SmallButton'  name=button>
<INPUT onclick="choice=2; calc(); return true" type=button size=5 value=开氏度 class='SmallButton'  name=button>
<INPUT onclick="choice=3; calc(); return true" type=button size=5 value=兰氏度 class='SmallButton'  name=button>
<INPUT onclick="choice=4; calc(); return true" type=button size=5 value=列氏度 class='SmallButton'  name=button>
                        </FORM>
</td>
                          </tr>
                          <tr>
                            <td><strong>换算结果:</strong></td>
                          </tr>
                          <tr>
                            <td>
<FORM name=boxes>
                        <INPUT name=b1 type=number class="SmallInput" size=15> <INPUT name=b1a
                          type=number class="SmallInput" size=8>   |
                          <INPUT name=b2 type=number class="SmallInput" size=15> <INPUT name=b2a type=number class="SmallInput"
                          size=8> <BR><INPUT
                          name=b3 type=number class="SmallInput" size=15> <INPUT name=b3a type=number class="SmallInput" size=8>
                            |   <INPUT
                          name=b4 type=number class="SmallInput" size=15> <INPUT name=b4a type=number class="SmallInput" size=8>
<BR><INPUT name=b5 type=number class="SmallInput" size=15> <INPUT name=b5a
                          type=number class="SmallInput" size=8> <BR>
<BR><INPUT onclick=clearForm(this.form) type=reset value=数据重置 class='SmallButton'  name=reset>
                        </UL></FORM>
</td>
                          </tr>
                          <tr>
                            <td>
</td>
                          </tr>
                        </table>
                        <BR>
                    </TR>
                    </TBODY>
</TABLE>
</body>
</html>


0
0
收藏0
回帖

温度换算js脚本代码分享 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息