求大佬帮我看看哪里错了

来源:5-6 编程练习

qq_慕沐4415436

2019-10-20 15:31

<!DOCTYPE  HTML>

<html >

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>函数</title>


<script type="text/javascript">

function cond(x,y){

   

    if(x>y)

    {

        return x;

    }

    else if(x<y)

    {

        return y;

    }else

    {return "两数相等"}

}

 document.write("5和6的较大值:"+cond(5,6)+"<br/>");

 document.write("6和4的较大值:"+cond(6,4)+"<br/>");

 document.write("55和55的较大值:"cond(55,55));






</script>

</head>

<body>

</body>

</html>


写回答 关注

3回答

  • 玖c
    2019-10-20 16:09:27
    已采纳

    两数相等后面没有";"分号,"55和55的较大值:"+cond(55,55),我也初学,就看到这,你改的试试?


  • 土豆我是地瓜呀
    2019-11-25 21:01:25

     document.write("55和55的较大值:"+cond(55,55));

    不过建议 var sum1= cond(55,55);


  • 慕叽叽
    2019-11-01 09:45:54

    "55和55的较大值:"后面少了个加号吧?

JavaScript进阶篇

本课程从如何插入JS代码开始,带您进入网页动态交互世界

467393 学习 · 21877 问题

查看课程

相似问题