简体   繁体   English

javascript-如何通过在 Chrome 中调试在一个 if 语句中查看每个条件的结果?

[英]javascript-how can I see result of every condition in one if statement By Debugging in Chrome?

I Have some javascript code that has if statements with multiple conditions.我有一些具有多个条件的 if 语句的 javascript 代码。

I want to see which one is true or false in chrome debugging.我想看看chrome调试中哪个是真假。

for example:例如:

if(a.value=='' || (document.getElementById('test') && document.getElementById('test').value==='') || myfom_upload.value==='' || document.forms['test_form']['name'].value==='' || document.getElementById('test_id').value==='' )
{
 //some codes.
}

I want to see result of:我想看看结果:

(a.value=='') ====>(true or false)? (a.value=='') ====>(true or false)?

(document.getElementById('test')) ====>(true or false)? (document.getElementById('test')) ====>(true or false)?

document.getElementById('test') ====>(true or false)? document.getElementById('test') ====>(真还是假)?

(document.getElementById('test').value==='') ====> (true or false)? (document.getElementById('test').value==='') ====> (true or false)?

(myfom_upload.value==='') ====>(true or false)? (myfom_upload.value==='') ====>(true or false)?

document.forms['test_form']['name'].value==='' ====>(true or false)? document.forms['test_form']['name'].value==='' ====>(真还是假)?

document.getElementById('test_id').value==='' ====>(true or false)? document.getElementById('test_id').value==='' ====>(true or false)?

How can I see result of every condition in one if statement By Debugging in Chrome?如何通过在 Chrome 中调试在一个 if 语句中查看每个条件的结果?

Is there anyway in console.log or something else?无论如何在console.log 或别的什么?

Thanks谢谢

  1. Place your breakpoint on the line with the if condition将断点放在带有 if 条件的行上
  2. Trigger the event that executes the code.触发执行代码的事件。
  3. When the execution pauses at the breakpoint, drag your cursor over to select a.value and hover over the selected text.当执行在断点处暂停时,将 Z1791A97A8403730EE0760489AEB992Z 拖到 select a.value和 hover 上。 You'll be able to see the value.您将能够看到价值。
  4. Repeat重复

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Javascript-我如何突出显示与HTML中的表单用户输入文本区域匹配的元素数组 - Javascript-How Can i Highlight array of elements that matches with form User input textarea in HTML JavaScript-如何将onClick函数添加到动态创建的按钮元素中? - JavaScript-How can I add an onClick function to a dynamically created button element? javaScript-我们如何将一个eventListener设置为另一个eventListener的从属? - javaScript-how can we set a eventListener as a slave of the other eventListener? 如何查看chrome中infor循环的javascript的每一步? - how to see every step of javascript for in loop in chrome? Javascript-如何在一个6个字母长的单词中混合字母并将每个字母放入特定的按钮 - Javascript-how to mix letters in a 6 letter-long word and put every letter to a specific button javascript-如何在iframe中检测滚动事件? - javascript-How to detect scroll event in iframe? Javascript - 我看不到值总和的结果 - Javascript - I can not see the result of the sum of values 如何使用 Javascript 在每个输入上重置 for 语句? - How can I reset a for statement on every input with Javascript? 在Android上调试javascript时如何查看断点(并查看错误行号)? - How can I hit breakpoints (and see error line numbers) when debugging javascript on Android? 如何检查if语句的条件以查看其是否正常运行? - How do I check my condition on an if statement to see if it is working correctly?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM