1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- <!-- 写一段js代码 -->
- <script>
- // 一段逻辑
- function surprise(){
- // alert("hello 我是惊喜!")
-
- // 非零数字 判断为true
- // if(0){
- // console.log(true)
- // }else{
- // console.log(false)
- // }
- // // 非空字符串 判断为true
- // if('false'){
- // console.log(true)
- // }else{
- // console.log(false)
- // }
- // var monthStr = prompt("请输入月份:")
- // var month = Number.parseInt(monthStr)
- // switch(month){
- // case 3:
- // case 4:
- // case 5:
- // console.log("春天")
- // break
- // case 6:
- // case 7:
- // case 8:
- // console.log("夏天")
- // break
- // default:
- // console.log("不知道什么天")
- // }
- // 九九乘法表
- var i = 1
- while(i <= 9){
- var j = 1
- while(j <= i){
- document.write(j + "*" + i + "=" + i*j + " ")
- j++
- }
- document.write("<br>")
- i++
- }
- }
- </script>
- </head>
- <body>
- <!-- onclick是点击按钮触发的事件 -->
- <button onclick="surprise()">点我点我点我</button>
-
- </body>
- </html>
|