emailg 2016-11-22 04:29 采纳率: 0%
浏览 3497

javascript里面两个if,为什么只有当第一个if括号里面为true时,下面的语句才可以执行?


function check() {

        if(Trim(document.reply.title.value) == "") {
            alert("please intput the title!");
            document.reply.title.focus();
            //return false;
        }

        alert("please intput the content!");

        if(Trim(document.reply.cont.value) == "") {
            alert("please intput the content!");
            document.reply.cont.focus();
            return false;
        } 

        return true;
    }

    javascript里面两个if,为什么只有当第一个if括号里面为true时,下面的语句才可以执行?
  • 写回答

4条回答

  • Go 旅城通票 2016-11-22 04:52
    关注

    你下面的语句指什么,alert("please intput the content!");之后的?
    就你这个代码是不是true都会执行下面的代码,

    有个可能就是true不执行下面的,而不是执行下面的,为true会执行代码段,如果报错就不会继续执行了,而不是执行

    评论

报告相同问题?

悬赏问题

  • ¥15 Stata 面板数据模型选择
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用