Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript意外标识符_Javascript_Html_Dom - Fatal编程技术网

Javascript意外标识符

Javascript意外标识符,javascript,html,dom,Javascript,Html,Dom,出于某种奇怪的原因,这行代码被标识为 这条特定的线路是 `Unexpected identifier` bmr = 66 + ( 6.23 * weightInlbs ) + ( 12.7 heightInInches ) - ( 6.8 * age ); 这就是全部代码 function metricComputation() { var age = document.getElementById("age"); var weightInlbs = docu

出于某种奇怪的原因,这行代码被标识为

这条特定的线路是

  `Unexpected identifier` 

    bmr =  66 + ( 6.23 * weightInlbs ) + ( 12.7 heightInInches ) - ( 6.8 * age );
这就是全部代码

function metricComputation() {
    var age = document.getElementById("age");
    var weightInlbs = document.getElementById("weight");
    var heightInInches =  feetToInches(new Number(document.getElementById("heightinFt")) , document.getElementById("heightinIn"));
    var bmr;
    var gender = document.getElementById("gender");


    if(gender === "male"){
         bmr =  66 + ( 6.23 * weightInlbs ) + ( 12.7 heightInInches ) - ( 6.8 * age );
    }

}
这就是全部的标记

<!DOCTYPE>
<html>
    <head>
        <script src="bmrcalc.js"></script>
    </head>
        <body>
            <center>
                    <h1>Basal Metabolic Rate</h1>
                Height: <input type = "text" id ="heightinFt"> ft  <input type = "text" id = "heightinIn"> in <br>
                Weight: <input type = "text" id ="weight">lbs<br>
                Age: <input type = "text" id = "age"><br>
                Gender:<select id = "gender">
                    <option value = "male">Male</option>
                    <option value = "female">Female</option>
                <select> <br>
                <button onclick = "metricComputation()">Compute</button>
                <div id = "result"></div>
            </center>
        </body>
</html>

基础代谢率
高度:英尺英寸
重量:磅
年龄:
性别: 男性 女性
计算
你的意思是乘法吗

bmr =  66 + ( 6.23 * weightInlbs ) + ( 12.7 * heightInInches ) - ( 6.8 * age );
// -----------------------------------------/\
以下是错误:

12.7 heightInInches
标识符
heightInches
预计不在此位置。期望的是像*、+、-或这样的运算符/

if(gender === "male"){
     bmr =  66 + ( 6.23 * weightInlbs ) + ( 12.7 * heightInInches ) - ( 6.8 * age );
}
您忘记了
(12.7高度英寸)中的*

您在“12.7”和高度英寸之间缺少“*”:


等等,没有看到错误。我不会在上网本中再次编码。请检查出现异常的代码列
bmr =  66 + ( 6.23 * weightInlbs ) + ( 12.7 * heightInInches ) - ( 6.8 * age );