switch

    xiaoxiao2021-03-26  13

    <html> <head> <meta charset="utf-8"> <title>js</title> </head> <body> <p>点击下面的按钮,会显示出基于今日日期的消息:</p> <button οnclick="myFunction()">点击这里</button> <p id="demo"></p> <script> function myFunction() { var x; var d=new Date().getDay(); switch (d)   {   case 2:   case 3:   case 4:   case 6:     x="Today it's Saturday";     break;   case 0:     x="Today it's Sunday";     break;   default:     x="Looking forward to the Weekend";   } document.getElementById("demo").innerHTML=x; } </script> <?php switch ($i) {  case 0:  case 1:  case 2:   echo "i is less than 3 but not negative";   break;  case 3:   echo "i is 3"; } ?> </body> </html>
    转载请注明原文地址: https://ju.6miu.com/read-650140.html

    最新回复(0)