Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.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 我的HTML页面在一次、两次或三次迭代后刷新。怎么了?_Javascript_Html - Fatal编程技术网

Javascript 我的HTML页面在一次、两次或三次迭代后刷新。怎么了?

Javascript 我的HTML页面在一次、两次或三次迭代后刷新。怎么了?,javascript,html,Javascript,Html,我正在写一个叶片应力例程,所有输入字段都应该是数字 Claculate按钮将计算,然后有时刷新(您可以看到来自脚本的表格填写),刷新将取出表格答案和所有填写的值 当它不刷新时,我可以打印页面或更改值,然后再次点击计算。这就是HTML应用程序的意图 关于浏览器有什么我不知道的吗 我在Opera上试过,调试完成整个Calc1()功能,然后继续跟踪到Opera代码,所以点击F8,它有时会工作有时会刷新页面。我试过Chrome Firefox在计算机上不能正常工作,必须重新加载它 感谢您提供任何可以解决

我正在写一个叶片应力例程,所有输入字段都应该是数字

Claculate按钮将计算,然后有时刷新(您可以看到来自脚本的表格填写),刷新将取出表格答案和所有填写的值

当它不刷新时,我可以打印页面或更改值,然后再次点击计算。这就是HTML应用程序的意图

关于浏览器有什么我不知道的吗

我在Opera上试过,调试完成整个Calc1()功能,然后继续跟踪到Opera代码,所以点击F8,它有时会工作有时会刷新页面。我试过Chrome Firefox在计算机上不能正常工作,必须重新加载它

感谢您提供任何可以解决此问题的反馈

这是我的密码:

<!-- turn on quirks mode for IE -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>MixPro&reg; BladeStress 3000 & 4000</title>    
    <style>
      label {
        display: inline-block;
        width: 170px;
      }
      span {
          line-height: 1.0;
      }
    </style>
</head>
<body>
<section>
<div id="header" style="position: fixed;  top: 0;  left: 0;  width: 100%;  height: 10px;">
      <div style="margin-top:5px; margin-left:5px; margin-right:5px;">
        <div style="width:25%; float:left; text-align:left;"><img src="/tracker/static/mixpro.jpg" alt="MixPro Logo"></div>
        <div style="width:50%; float: left; text-align:center; font-family: TeXGyreChorus; font-size: 35px;">
            <!-- <div><img src="/tracker/static/vortex.jpg" alt="Squirrel" style="float: left; height:110px;"></div>-->
          <div><bold><br>MixPro<sup>&reg;</sup> BladeStress 3000 & 4000</bold></div>
        </div>
        <div style="width:25%; float: left; text-align:right;"><img src="/tracker/static/mixpro.jpg" alt="MixPro Logo"></div>
      </div>
</div>  
</section>
    <div style="border-style: double; margin-top:150px; margin-left:50px; margin-right:50px; line-height: 1.7;" id='maindiv'>
        <form autocomplete="off" style="padding-left: 50px;">
            <label for="mpower">Motor Power:</label>
            <input type="text" id="mpower"><br>
            <label for="slurrySG">Slurry Specific Gravity:</label>
            <input type="text" id="slurrySG"><br>
            <label for="HSF">Hydraulic Service Factor:</label>
            <input type="text" id="HSF"><br>
            <label for="TF">Turbine Factor:</label>
            <input type="text" id="TF"><br>
            <label for="shdia">Shaft Diameter:</label>
            <input type="text" id="shdia"><br>
            <label for="hubdia">Hub Diameter:</label>
            <input type="text" id="hubdia"><br>
            <label for="ImpellerType">Impeller Type:</label>
            <select id="ImpellerType">
              <option value="3300">3300</option>
              <option value="3400">3400</option>
              <option value="4445">4445</option>
              <option value="4490">4490</option>
            </select><br>
            <label for="pdia">Impeller Diameter:</label>
            <input type="text" id="pdia"><br>
            <label for="n">Output Speed:</label>
            <input type="text" id="n"><br>
            <label for="ConnectionType">Connection Type:</label>
            <select id="ConnectionType" onchange="ConnectionType1()">
              <option value="Bolted">Bolted</option>
              <option value="Welded">Welded</option>
            </select><br>
            <label id="learth" for="earth">Ear Thickness:</label>
            <input type="text" id="earth"><br id="bearth">
            <label for="bladeth">Blade Thickness:</label>
            <input type="text" id="bladeth"><br>
            Gusset:
                <label style="margin-left:117px;" class="radio-inline">
                  <input type="radio" onchange="handleClick1();" name="radio1">Yes
                </label>
                <label class="radio-inline">
                  <input style="margin-left:-95px;" type="radio" onchange="handleClick2();" name="radio1">No
                </label>
            <br>
            <label style="display: none;" id="lgussth" for="gussth">Gusset Thickness:</label>
            <input style="display: none;" type="text" id="gussth" name="gussth"><br style="display: none;" id="bgussth">
            <label style="display: none;" id="lnguss" for="nguss">Number of Gussets:</label>
            <input style="display: none;" type="text" id="nguss" name="nguss"><br style="display: none;" id="bnguss">
            <button style="margin-left:170px; width:80px;" id="Calc" value="Calc" onclick="Calc1()">Calculate</button>
            <button style="width:80px;"id="Print" value="Print" onclick="window.print()">Print</button>
            <br>
            <table style="line-height: 1.2; width:65%;">
                <tr>
                    <th id="stresstitle" style="text-align:left"></th>
                </tr>
                <tr>
                    <td id="earstress1"></td>
                    <td id="earstress2" style="text-align:right"></td>
                </tr>
                <tr>
                    <td id="bladestress1"></td>
                    <td id="bladestress2" style="text-align:right"></td>
                </tr>
                <tr>
                    <td id="powerdraw1"></td>
                    <td id="powerdraw2" style="text-align:right"></td>
                </tr>
                <tr>
                    <th id="taper" style="text-align:left"></th>
                </tr>
            </table>
        </form>
    </div>
    
<script language='javascript'>
    var gusset = false;
    var bolted = true;
    var inputvalid = true;
    function handleClick1() {
        document.getElementById("lgussth").style.display = "inline-block";
        document.getElementById("gussth").style.display = "inline";
        document.getElementById("bgussth").style.display = "inline";
        document.getElementById("lnguss").style.display = "inline-block";
        document.getElementById("nguss").style.display = "inline";
        document.getElementById("bnguss").style.display = "inline";
        gusset = true;
    }
    function handleClick2() {
        document.getElementById("lnguss").style.display = "none";
        document.getElementById("nguss").style.display = "none";
        document.getElementById("bnguss").style.display = "none";
        document.getElementById("lgussth").style.display = "none";
        document.getElementById("gussth").style.display = "none";
        document.getElementById("bgussth").style.display = "none";
        document.getElementById("gussth").value = null;
        document.getElementById("nguss").value = null;
        gusset = false;
    }
    function ConnectionType1() {
      var x = document.getElementById("ConnectionType").value;
      if (x == "Bolted") {
        document.getElementById("learth").style.display = "inline-block";
        document.getElementById("earth").style.display = "inline";
        document.getElementById("bearth").style.display = "inline";
        bolted = true;
      } else {
        document.getElementById("learth").style.display = "none";
        document.getElementById("earth").style.display = "none";
        document.getElementById("bearth").style.display = "none";
        bolted = false;
      }
    }
    function Calc1() {
        if (isNaN(document.getElementById("mpower").value)) {
            alert("Motor Power Must be a number");
            inputvalid = false;
        } else {
            if (document.getElementById("mpower").value == 0) {
                alert("Motor Power Must not be blank");
                inputvalid = false;
            }
        }
        if (isNaN(document.getElementById("slurrySG").value)) {
            alert("Slurry Specific Gravity Must be a number");
            inputvalid = false;
        } else {
            if (document.getElementById("slurrySG").value == 0) {
                alert("Slurry Specific Gravity Must not be blank");
                inputvalid = false;
            }
        }
        if (isNaN(document.getElementById("HSF").value)) {
            alert("Hydraulic Service Factor Must be a number");
            inputvalid = false;
        } else {
            if (document.getElementById("HSF").value == 0) {
                alert("Hydraulic Service Factor Must not be blank");
                inputvalid = false;
            }
        }
        if (isNaN(document.getElementById("TF").value)) {
            alert("Turbine Factor Must be a number");
        } else {
            if (document.getElementById("TF").value == 0) {
                alert("Turbine Factor Must not be blank");
            }
        }
        if (isNaN(document.getElementById("shdia").value)) {
            alert("Shaft Diameter Must be a number");
            inputvalid = false;
        } else {
            if (document.getElementById("shdia").value == 0) {
                alert("Shaft Diameter Must not be blank");
                inputvalid = false;
            }
        }
        if (isNaN(document.getElementById("hubdia").value)) {
            alert("Hub Diameter Must be a number");
            inputvalid = false;
        } else {
            if (document.getElementById("hubdia").value == 0) {
                alert("Hub Diameter Must not be blank");
                inputvalid = false;
            }
        }
        if (isNaN(document.getElementById("pdia").value)) {
            alert("Impeller Diameter Must be a number");
            inputvalid = false;
        } else {
            if (document.getElementById("pdia").value == 0) {
                alert("Impeller Diameter Must not be blank");
                inputvalid = false;
            }
        }
        if (isNaN(document.getElementById("n").value)) {
            alert("Output Speed Must be a number");
            inputvalid = false;
        } else {
            if (document.getElementById("n").value == 0) {
                alert("Output Speed Must not be blank");
                inputvalid = false;
            }
        }
        if (document.getElementById("ConnectionType").value == "Bolted") {
            if (isNaN(document.getElementById("earth").value)) {
                alert("Ear Thickness Must be a number");
                inputvalid = false;
            } else {
                if (document.getElementById("earth").value == 0) {
                    alert("Ear Thickness Must not be blank");
                    inputvalid = false;
                }
            }
        } else {
            document.getElementById("earth").value = "";
        }
        if (isNaN(document.getElementById("bladeth").value)) {
            alert("Blade Thickness Must be a number");
            inputvalid = false;
        } else {
            if (document.getElementById("bladeth").value == 0) {
                alert("Blade Thickness Must not be blank");
                inputvalid = false;
            }
        }
        if (gusset) {
            if (isNaN(document.getElementById("gussth").value)) {
                alert("Gusset Thickness Must be a number");
                inputvalid = false;
            } else {
                if (document.getElementById("gussth").value == 0) {
                    alert("Gusset Thickness Must not be blank");
                    inputvalid = false;
                }
            };
            if (isNaN(document.getElementById("nguss").value)) {
                alert("Number of Gussets Must be a number");
                inputvalid = false;
            } else {
                if (document.getElementById("nguss").value == 0) {
                    alert("Number of Gussets Must not be blank");
                    inputvalid = false;
                }
            }
        } else {
            document.getElementById("gussth").value = "";
            document.getElementById("nguss").value = "";
        };
        if (inputvalid) {
            var hp = Number(document.getElementById("mpower").value);
            var sg = Number(document.getElementById("slurrySG").value);
            var hsf = Number(document.getElementById("HSF").value);
            var tf = Number(document.getElementById("TF").value);
            var shdia = Number(document.getElementById("shdia").value);
            var hubdia = Number(document.getElementById("hubdia").value);
            var imptype = document.getElementById("ImpellerType").value;
            var pdia = Number(document.getElementById("pdia").value);
            var n = Number(document.getElementById("n").value);
            var contype = document.getElementById("ConnectionType").value;
            var earth = Number(document.getElementById("earth").value);
            var bladeth = Number(document.getElementById("bladeth").value);
            var nguss = Number(document.getElementById("nguss").value);
            var gussth = Number(document.getElementById("gussth").value);
            var pguss = "";
            var earlen = 0;
            switch(imptype) {
                case "3300":
                    var bladeang = 45;
                    var nblades = 3;
                    var npo = 0.3;
                    var c = 0.6;
                    var bladefac = 0.16;
                    if (bolted) {
                        if (pdia >= 90) {
                            var earwdth = Math.round(2 * pdia / 11 + .49) / 2;
                        } else {
                            var earwdth = Math.round(2 * pdia / 12 + .49) / 2;
                        }
                        hubear = hubdia * .85 / Math.sin(bladeang * Math.PI / 180);
                        if (hubear < earwdth) {
                            earwdth2 = hubear;
                        } else {
                            earwdth2 = earwdth;
                        }
                    }
                    break;
                case "3400":
                    var bladeang = 45;
                    var nblades = 4;
                    var npo = 0.37;
                    var c = 0.7;
                    var bladefac = 0.16;
                    if (bolted) {
                        if (pdia >= 90) {
                            var earwdth = Math.round(2 * pdia / 11 + .49) / 2;
                        } else {
                            var earwdth = Math.round(2 * pdia / 12 + .49) / 2;
                        }
                        hubear = hubdia * .85 / Math.sin(bladeang * Math.PI / 180);
                        if (hubear < earwdth) {
                            earwdth2 = hubear;
                        } else {
                            earwdth2 = earwdth;
                        }
                    }
                    break;
                case "4445":
                    var bladeang = 45;
                    var nblades = 4;
                    var npo = 1.27;
                    var c = 1.2107;
                    var bladefac = 0.19;
                    if (bolted) {
                        var earwdth = Math.round(2 * pdia * 0.095 + .49) / 2;
                        hubear = hubdia * .85 / Math.sin(bladeang * Math.PI / 180);
                        if (hubear < earwdth) {
                            earwdth2 = hubear;
                        } else {
                            earwdth2 = earwdth;
                        }
                    }
                    break;
                case "4490":
                    var bladeang = 90;
                    var nblades = 4;
                    var npo = 3.64;
                    var c = 1.97;
                    var bladefac = 0.19;
                    if (bolted) {
                        var earwdth = Math.round(2 * pdia * 0.095 + .49) / 2;
                        hubear = hubdia * .85 / Math.sin(bladeang * Math.PI / 180);
                        if (hubear < earwdth) {
                            earwdth2 = hubear;
                        } else {
                            earwdth2 = earwdth;
                        }
                    }
                    break;
            }
            var bladewdth = bladefac * pdia;
            if (bolted) {
                earlen = earwdth + earth + .125;
            }
            var Fa = 0.97 * sg * c * Math.pow((n / 60), 2) * Math.pow((pdia / 12), 4) / nblades;
            var Ft = 0.7705 * sg * npo * tf * Math.pow((n / 60), 2) * Math.pow((pdia / 12), 4) / nblades;
            var Fra = Fa * Math.cos(bladeang * Math.PI / 180) + Ft * Math.sin(bladeang * Math.PI / 180);
            var Fr = (0.8 + 0.2 * hsf) * Fra;
            var Mblade = Fr * (0.4 * pdia - 0.5 * hubdia - earlen);
            if (bolted) {
                var Mear = Fr * (0.4 * pdia - 0.5 * hubdia);
                var bladestress = 6 * Mblade / (bladewdth * Math.pow(bladeth, 2));
                if (gusset) {
                    var gussht = Math.round(4 * pdia / 32 + .49) / 4;
                    var NAxis = (((earth / 2) * earwdth * earth) + ((earth + (gussht / 2)) * gussht * gussth * nguss)) / (earth * earwdth + gussht * gussth * nguss);
                    var MInert = (((1 / 12) * earwdth * Math.pow(earth, 3)) + (earwdth * earth * Math.pow((NAxis - (earth / 2)), 2))) + ((1 / 12) * nguss * gussth * Math.pow(gussht, 3)) + (nguss * gussth * gussht * Math.pow((NAxis - (earth + (gussht / 2))), 2));
                    var earstress = Mear * (earth + gussht - NAxis) / MInert;
                    pguss = "with Gusset(s)";
                } else {
                    var NAxis = earth/2;
                    var MInert = ((1 / 12) * earwdth * Math.pow(earth, 3));
                    var earstress = Mear * (earth - NAxis) / MInert;
                }
            } else {            
                var NAxis = bladeth/2;
                var hubear = hubdia * .85 / Math.sin(bladeang * Math.PI / 180);
                if (hubear < bladewdth) {
                    var earwdth2 = hubear;
                } else {
                    var earwdth2 = bladewdth;
                }
                var MInert = ((1 / 12) * earwdth2 * (bladeth ^ 3));
                var bladestress = 6 * Mblade / (earwdth2 * Math.pow(bladeth, 2));
            }
            var PD = (npo * sg * tf * Math.pow((n / 60), 3) * Math.pow((pdia * 25.4 / 1000), 5)) / 0.746;
            document.getElementById("stresstitle").innerHTML = contype + " Blade MP-"+imptype+ " Impeller "+pguss;
            if (bolted) {
                document.getElementById("earstress1").innerHTML = "\u03C3, Ear-root (psi)";
                document.getElementById("earstress2").innerHTML = earstress.toFixed(2);
            }
            document.getElementById("bladestress1").innerHTML = "\u03C3, Blade at ear tip       (psi)";
            document.getElementById("bladestress2").innerHTML = bladestress.toFixed(2);
            document.getElementById("powerdraw1").innerHTML = " Impeller Power Draw        (hp)";
            document.getElementById("powerdraw2").innerHTML = PD.toFixed(2);
            if (bolted) {
                if (earwdth > earwdth2) {
                    document.getElementById("taper").innerHTML = "Note: Ear Width tapered at hub weld from "+earwdth+" to "+earwdth2;
                }
            } else {
                if (bladewdth > earwdth2) {
                    document.getElementById("taper").innerHTML = "Note: Blader Width tapered at hub weld from "+bladewdth+" to "+earwdth2;
                }
            }
        };
    }
</script>
</body>
</html>

MixPro®;叶片压力3000和4000
标签{
显示:内联块;
宽度:170px;
}
跨度{
线高:1.0;
}

MixPro®;叶片压力3000和4000 电机功率:
泥浆比重:
液压工作系数:
涡轮系数:
轴直径:
轮毂直径:
叶轮类型: 3300 3400 4445 4490
叶轮直径:
输出速度:
连接类型: 栓住 焊接
耳朵厚度:
叶片厚度:
角撑板: 对 不
角撑板厚度:
角撑板数量:
算计 印刷品
var-gusset=false; var=true; var inputvalid=true; 函数handleClick1(){ document.getElementById(“lgussth”).style.display=“内联块”; document.getElementById(“gussh”).style.display=“inline”; document.getElementById(“bgussth”).style.display=“inline”; document.getElementById(“lnguss”).style.display=“内联块”; document.getElementById(“nguss”).style.display=“inline”; document.getElementById(“BNGUS”).style.display=“inline”; 角撑板=真; } 函数handleClick2(){ document.getElementById(“lnguss”).style.display=“无”; document.getElementById(“nguss”).style.display=“无”; document.getElementById(“BNGUS”).style.display=“无”; document.getElementById(“lgussth”).style.display=“无”; document.getElementById(“gussh”).style.display=“无”; document.getElementById(“bgussth”).style.display=“无”; document.getElementById(“gussh”).value=null; document.getElementById(“nguss”).value=null; 角撑板=假; } 函数ConnectionType1(){ var x=document.getElementById(“ConnectionType”).value; 如果(x==“螺栓连接”){ document.getElementById(“learth”).style.display=“内联块”; document.getElementById(“earth”).style.display=“inline”; document.getElementById(“bearth”).style.display=“inline”; 螺栓连接=正确; }否则{ document.getElementById(“learth”).style.display=“无”; document.getElementById(“地球”).style.display=“无”; document.getElementById(“bearth”).style.display=“无”; 螺栓连接=假; } } 函数Calc1(){ if(isNaN(document.getElementById(“mpower”).value)){ 警报(“电机功率必须为数字”); inputvalid=false; }否则{ if(document.getElementById(“mpower”).value==0){ 警报(“电机功率不得为空”); inputvalid=false; } } if(isNaN(document.getElementById(“slurrySG”).value)){ 警报(“泥浆比重必须为数字”); inputvalid=false; }否则{ if(document.getElementById(“slurrySG”).value==0){ 警报(“泥浆比重不得为空”); inputvalid=false; } } if(isNaN(document.getElementById(“HSF”).value)){ 警报(“液压工作系数必须是一个数字”); inputvalid=false; }否则{ if(document.getElementById(“HSF”).value==0){ 警报(“液压工作系数不得为空”); inputvalid=false; } } if(isNaN(document.getElementById(“TF”).value)){ 警报(“涡轮机系数必须是一个数字”); }否则{ if(document.getElementById(“TF”).value==0){ 警报(“涡轮机系数不得为空”); } } if(isNaN(document.getElementById(“shdia”).value)){ 警告(“轴直径必须是一个数字”); inputvalid=false; }否则{ if(document.getElementById(“shdia”).value=