Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.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 If语句是否在代码执行后停止代码?_Javascript - Fatal编程技术网

Javascript If语句是否在代码执行后停止代码?

Javascript If语句是否在代码执行后停止代码?,javascript,Javascript,我有一个订单脚本,其中有一个函数,可以告诉我工作是否需要比x更长的时间,并弹出一条消息。如果我不使用if语句,脚本可以正常工作,但如果我把它放进去,它只在X变量满足if条件时执行,这有意义吗 我的剧本是 if (EstimatedCoreHours >= 50000) { document.getElementById("AccountManagement").innerHTML='You have a big Job on your hands - Contact Us!';

我有一个订单脚本,其中有一个函数,可以告诉我工作是否需要比x更长的时间,并弹出一条消息。如果我不使用if语句,脚本可以正常工作,但如果我把它放进去,它只在X变量满足if条件时执行,这有意义吗

我的剧本是

if (EstimatedCoreHours >= 50000)
   {
   document.getElementById("AccountManagement").innerHTML='You have a big Job on your hands - Contact Us!';
   document.getElementById("AccountManagement").style.backgroundColor="yellow";
   }
   else
   {
   document.getElementById("AccountManagement").innerHTML=''; 
   document.getElementById("ContBtn").style.display="";
   }

   if (EstimatedCoreHours >= 100000)
   {
   document.getElementById("LeadTimes").innerHTML='5 Business Days!';
   document.getElementById("LeadTimes").style.backgroundColor="yellow";
   }
   else if (EstimatedCoreHours >=25000)
   {
   document.getElementById("LeadTimes").innerHTML='2 Days';  
   document.getElementById("LeadTimes").style.backgroundColor="yellow";
   }
   else
   {
   document.getElementById("LeadTimes").innerHTML='Right Away'; 
   document.getElementById("LeadTimes").style.backgroundColor="yellow";  
   }

If语句不会停止执行。当解释器在代码中遇到错误时,执行停止。检查if中使用的变量是否已定义。

此处混合了ifs和else ifs,缩进错误。如果估计时间为150000,那么前两个ifs将同时开火。你是说它们要嵌套吗

最后一点,标准是50000、100000、25000。您是故意乱序测试这些值,还是这里有输入错误