Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.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_Input_Error Handling_Output - Fatal编程技术网

Javascript 有人能发现我代码中的错误吗?我的html无法适应更改的值

Javascript 有人能发现我代码中的错误吗?我的html无法适应更改的值,javascript,html,input,error-handling,output,Javascript,Html,Input,Error Handling,Output,出于某种原因,我的html没有适应我放入的JavaScript。标签没问题,但由于某种原因,我的网站对输入框中的更改没有反应*请帮我找出问题所在*下面给出了转换器代码以及HTML JAVASCRIPT let VSWRout = document.getElementById('VSWRout'); let Mismatchout2 = document.getElementById('MisMatchOut2'); let RLin = document.getElementById('RLi

出于某种原因,我的html没有适应我放入的JavaScript。标签没问题,但由于某种原因,我的网站对输入框中的更改没有反应*请帮我找出问题所在*下面给出了转换器代码以及HTML

JAVASCRIPT

let VSWRout = document.getElementById('VSWRout');
let Mismatchout2 = document.getElementById('MisMatchOut2');
let RLin = document.getElementById('RLin1');

/**
 * @return {number}
 */
function RLintoVSWRout(){
    return Math.round((Math.pow(10,((parseFloat(RLin.value))/20)) + 1) / (Math.pow(10,((parseFloat(RLin.value))/20)) - 1) * 100) /100;
}
/**
 * @return {number}
 */
function RLintoMismatchout2(){
    return Math.round((-10 * Math.log10(Math.pow((Math.pow(10,(-parseFloat(RLin.value)/ 20))), 2)))*100) /100;
}
function RLconverter(){
    VSWRout.html = '<td id=VSWRout>' + RLintoVSWRout() + '</td>';
    Mismatchout2.html = '<td id=MisMatchOut2>' + RLintoMismatchout2() + '</td>'
}

RLin.addEventListener('change', RLconverter, false);
let VSWRout=document.getElementById('VSWRout');
设mistchout2=document.getElementById('mistchout2');
设RLin=document.getElementById('RLin1');
/**
*@return{number}
*/
函数RLintoVSWRout(){
返回Math.round((Math.pow(10,((parseFloat(RLin.value))/20))+1/(Math.pow(10,((parseFloat(RLin.value))/20))-1)*100)/100;
}
/**
*@return{number}
*/
函数rlintomatchhout2(){
返回Math.round(-10*Math.log10(Math.pow((Math.pow(10,(-parseFloat(RLin.value)/20))),2))*100)/100;
}
函数RLconverter(){
VSWRout.html=''+RLintoVSWRout()+'';
mismatchhout2.html=''+rlintomatchhout2()+''
}
RLin.addEventListener('change',RLconverter,false);
HTML

 <section>
      <!---VSWR, RL(dB), MismatchLoss(dB) -->
      <table id="VSWR,RL,MismatchLoss">
          <tr>
            <td>VSWR</td>
            <td>RL(dB)</td>
            <td>Mismatch Loss(dB)</td>
          </tr>

          <tr>
            <td><label for="VSWR"></label><input type="number" id="VSWR" min="1" /> </td>
            <td>later</td>
            <td>later</td>
          </tr>

          <tr>
            <td id="VSWRout"></td>
            <td><label for="RLin1"></label><input type="number" id="RLin1" min="0" /> </td>
            <td id="MisMatchOut2"></td>
          </tr>

      </table>      
    </section>

驻波比
RL(分贝)
失配损耗(dB)
后来
后来

我现在关注的是最后一行。

RLconverter
函数更改为使用innerHTML而不是html:

不正确:

function RLconverter(){
    VSWRout.html = '<td id=VSWRout>' + RLintoVSWRout() + '</td>';
    Mismatchout2.html = '<td id=MisMatchOut2>' + RLintoMismatchout2() + '</td>'
}
函数RLconverter(){
VSWRout.html=''+RLintoVSWRout()+'';
mismatchhout2.html=''+rlintomatchhout2()+''
}
正确:

function RLconverter(){
    VSWRout.innerHTML = '<td id=VSWRout>' + RLintoVSWRout() + '</td>';
    Mismatchout2.innerHTML = '<td id=MisMatchOut2>' + RLintoMismatchout2() + '</td>'
}
函数RLconverter(){
VSWRout.innerHTML=''+RLintoVSWRout()+'';
mistchout2.innerHTML=''+rlintomatchhout2()+''
}

确保清除缓存。如果有解决方案,请添加答案;不要把这个问题放在心上。