本文介绍了温度转换器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全坚持使用这个。

我必须创建一个温度转换计算器,将结果温度四舍五入到最接近的整数&反之亦然。结果必须显示在窗口警报中。给定的公式是(Fahrenheit_temp - 32)* .55

我唯一的提示/线索是使用

var tempInCelcius =(document.Converter.fahrenheit.value - 32)* .55;

var tempInFahrenheit =(document.Converter.celcius.value * 1.8)+ 32


我试过,删除,试过和再次删除。我很沮丧,感到自杀,我只是没有理解这个概念。


请帮助!


< html>

< head>

< title>转换温度< / title>


< script language =" JavaScript">


<! - 隐藏旧浏览器

函数tempConv(){

var TempInCelcius = document.Converter.fahrenheit .value - 32)* .55;

var TempInFahrenheit = document.Converter.celcius.value * 1.8)+ 32;


????? ? - 我无法得到正确的计算结果????????


// - >

< / script>


< / head>

< body>


< h1>转换温度< / h1> ;

< form name = data>

< p>< strong>以华氏温度输入温度< / strong>< / p>

< input type =" text"名称= QUOT;摄氏度"大小= QUOT; 10" align =" left">

< input type =" Button"对齐= QUOT;左" value ="转换为Celcius" onClick = tempConv()>

< br>

< p>< strong>以Celcius输入温度< / strong>< / p>

< input type =" text"名称= QUOT; fahrenheit_in"大小= QUOT; 10" align =" left">

< input type =" Button"对齐= QUOT;左" value ="转换为Fahrenheit" onClick =" tempConv()">


< / body>

< / html>

I am absolutely stuck with this one.
I have to create a temperature conversion calculator that rounds the resulting temperature to the nearest whole number & vice versa. The result must be displayed in a window alert. The given formula is (Fahrenheit_temp - 32) * .55
The only tip/clue I have is to use
var tempInCelcius = (document.Converter.fahrenheit.value - 32) * .55;
var tempInFahrenheit = (document.Converter.celcius.value * 1.8) + 32

I have tried, deleted, tried and deleted again. I am so frustrated and feeling suicidal that I am just not grasping the concept.

PLEASE HELP!

<html>
<head>
<title>Convert Temperature</title>

<script language="JavaScript">

<!--Hide from old browsers
function tempConv() {
var TempInCelcius = document.Converter.fahrenheit.value - 32) * .55;
var TempInFahrenheit = document.Converter.celcius.value * 1.8) + 32;

?????? - I cannot get the calc right????????


//-->
</script>

</head>
<body>

<h1>Convert Temperature</h1>
<form name=data>
<p><strong>Enter the temperature in Fahrenheit</strong></p>
<input type="text" name="Celcius" size="10" align="left">
<input type="Button" align="left" value="Convert to Celcius" onClick=tempConv()>
<br>
<p><strong>Enter the temperature in Celcius</strong></p>
<input type="text" name="fahrenheit_in" size="10" align="left">
<input type="Button" align="left" value="Convert to Fahrenheit" onClick="tempConv()">


</body>
</html>

推荐答案


展开 | 选择 | Wrap | 行号


展开 | 选择 | Wrap | 行号


这篇关于温度转换器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-27 17:07