【发布时间】:2017-02-05 11:43:51
【问题描述】:
您好,我用一些指南编写了一个带有 3 个输入字段的计算器,用于计算有氧运动的心率,但我似乎在将它们应用到我的 wordpress 中时遇到了问题
在 web 的 tryouteditor 中试用它时,它正在工作 (http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_div_default_css)
在 wordpress 中它只显示代码(是的,我在 HTML 中输入) 我没有服务器,所以我只用浏览器访问wordpress,没有使用插件
请帮帮我 代码如下:
<html>
<script>
function calc(form) {
var D = "0";
var E = "0";
var A = document.getElementById("num1").value;
var B = document.getElementById("op").value;
var C = document.getElementById("num2").value;
if (C === "GI")
{
D = parseInt(A)+((parseInt('220')-parseInt(B)-parseInt(A))*parseInt('5'))/parseInt('10')
E = parseInt(A)+((parseInt('220')-parseInt(B)-parseInt(A))*parseInt('6'))/parseInt('10');
}
else if(C === "A1")
{
D = parseInt(A)+((parseInt('220')-parseInt(B)-parseInt(A))*parseInt('6'))/parseInt('10');
E = parseInt(A)+((parseInt('220')-parseInt(B)-parseInt(A))*parseInt('7'))/parseInt('10');
}
else if(C === "A2")
{
D = parseInt(A)+((parseInt('220')-parseInt(B)-parseInt(A))*parseInt('7'))/parseInt('10');
E = parseInt(A)+((parseInt('220')-parseInt(B)-parseInt(A))*parseInt('8'))/parseInt('10');
}
else if (C === "A3")
{
D = parseInt(A)+((parseInt('220')-parseInt(B)-parseInt(A))*parseInt('8'))/parseInt('10');
E = parseInt(A)+((parseInt('220')-parseInt(B)-parseInt(A))*parseInt('9'))/parseInt('10');
}
else if (C === "A4")
{
D = parseInt(A)+((parseInt('220')-parseInt(B)-parseInt(A))*parseInt('9'))/parseInt('10');
E = parseInt(A)+((parseInt('220')-parseInt(B)-parseInt(A))*parseInt('10'))/parseInt('10');
}
document.getElementById("result").innerHTML = D;
document.getElementById("result2").innerHTML = E;
return false;
}
</script>
<body>
Heart Rate when waking up
<input type="text" id="num1" name="num1" />
<br>
Age
<input type="text" id="op" name="op" />
<br>
Intensity GI - A4
<input type="text" id="num2" name="num2" />
<br />
<input type="button" value="Solve" onClick="calc(this)">
<p id="result" name="r1">
<p id="result2" name="r2">
<br />
</p>
</body>
</html>
【问题讨论】:
-
请详细说明您的问题,以便我们知道问题所在。谢谢!
-
在 wordpress 中它只显示代码而不是代码应该做什么
标签: php html wordpress calculator